NEW 143158
HashTable should have inline capacity
https://bugs.webkit.org/show_bug.cgi?id=143158
Summary HashTable should have inline capacity
Alex Christensen
Reported 2015-03-27 15:36:07 PDT
Small HashSets have terrible performance compared to an array. Why not use an array with small sets? This is a step towards getting that working.
Attachments
Patch (98.27 KB, patch)
2015-03-27 15:40 PDT, Alex Christensen
no flags
Patch (98.49 KB, patch)
2015-03-27 16:36 PDT, Alex Christensen
no flags
Patch (98.44 KB, patch)
2015-03-27 17:43 PDT, Alex Christensen
no flags
Archive of layout-test-results from ews105 for mac-mavericks-wk2 (246.00 KB, application/zip)
2015-03-27 18:33 PDT, Build Bot
no flags
Patch (98.46 KB, patch)
2015-03-27 18:37 PDT, Alex Christensen
no flags
Patch (98.48 KB, patch)
2015-03-27 19:17 PDT, Alex Christensen
achristensen: review-
Alex Christensen
Comment 1 2015-03-27 15:40:48 PDT
Alex Christensen
Comment 2 2015-03-27 16:36:06 PDT
Alex Christensen
Comment 3 2015-03-27 17:43:00 PDT
Build Bot
Comment 4 2015-03-27 18:32:59 PDT
Comment on attachment 249626 [details] Patch Attachment 249626 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/5911759877570560 Number of test failures exceeded the failure limit.
Build Bot
Comment 5 2015-03-27 18:33:02 PDT
Created attachment 249629 [details] Archive of layout-test-results from ews105 for mac-mavericks-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews105 Port: mac-mavericks-wk2 Platform: Mac OS X 10.9.5
Alex Christensen
Comment 6 2015-03-27 18:37:47 PDT
Alex Christensen
Comment 7 2015-03-27 19:17:33 PDT
Alex Christensen
Comment 8 2015-03-27 20:19:29 PDT
Feel free to review, but I'm going to gather some data about HashTable sizes before landing this to have some speculative evidence that this is a good direction to go.
Alex Christensen
Comment 9 2015-03-30 15:47:39 PDT
In the destructor of HashTable I printed out the largest m_keyCount a HashTable had seen, and I found this histogram data from opening Gmail and Facebook in MiniBrowser: Max Size Hash Table Count 0 1187217 1 113932 2 64251 3 36962 4 23451 5 14731 6 12945 7 8240 8 6282 >8 39911 Most HashTables never get an entry. We already optimized for this case. >30% of HashTables that get entries only get 1 entry before being destroyed. >80% of HashTables that get entries never grow beyond a size of 8. Based on this data, I think it is worth looking into optimizing small HashTables and this is a step in the right direction.
Geoffrey Garen
Comment 10 2015-03-30 15:57:59 PDT
(In reply to comment #9) It seems like it would be especially valuable to optimize for the zero case. I don't think we quite do that right now, since an empty has table has a pretty large constant overhead. Perhaps a good first step is to make a table just a pointer, and use the null pointer to indicate an empty table. That would make the empty table 3X smaller. Side note: if we want to specialize for, say, the <= 3 case, the best specialization is probably to use a vector rather than a hash table.
Alex Christensen
Comment 11 2015-03-30 16:46:41 PDT
Comment on attachment 249635 [details] Patch I'm going to look into making a HashTable just a pointer. Inline capacity is too specific to my one use case, and it probably shouldn't go in WTF.
Note You need to log in before you can comment on or make changes to this bug.