Convert XPConnect hash tables to use mozilla::HashMap rather than PLDHashTable
Categories
(Core :: XPConnect, task, P3)
Tracking
()
People
(Reporter: jonco, Assigned: jonco)
Details
Attachments
(7 files)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
mozilla::HashMap and HashSet are based on templates and offer better performance compared to PLDHashTable because they offer more opportunity for inlining.
This change also offers the possibility of better integration with the JS GC's WeakCache API where hash tables are swept automatically rather than having to do this manually in a callback.
Assignee | ||
Comment 1•3 years ago
|
||
Assignee | ||
Comment 2•3 years ago
|
||
Depends on D126639
Assignee | ||
Comment 3•3 years ago
|
||
Depends on D126640
Assignee | ||
Comment 4•3 years ago
|
||
Depends on D126641
Assignee | ||
Comment 5•3 years ago
|
||
Confusingly it seems the matching function used with mozilla::HashSet receives
its arguments the other way round to the one for PLDHashTable. At least with
HashSet it is typed.
I didn't change the class's name although arguably it should be called NativeSetSet.
Depends on D126642
Assignee | ||
Comment 6•3 years ago
|
||
Depends on D126643
Comment 7•3 years ago
|
||
Nighty 94's code freeze is only three days from now. We probably shouldn't land such a big change this late in the release cycle.
Comment 8•3 years ago
|
||
needinfo'ing Nika because she may have opinions about PLDHashTable, mozilla::HashMap, and nsTHashtable.
Comment 9•3 years ago
|
||
(In reply to Jon Coppeard (:jonco) from comment #0)
mozilla::HashMap and HashSet are based on templates and offer better performance compared to PLDHashTable because they offer more opportunity for inlining.
This change also offers the possibility of better integration with the JS GC's WeakCache API where hash tables are swept automatically rather than having to do this manually in a callback.
What is the motivation for these patches? Are you seeing instances where the performance of these hash tables is an issue? There's a tradeoff between binary size and performance between these two implementations (although there are likely not a ton of call sites for operations on these hash tables so hopefully it won't be an issue.)
Assignee | ||
Comment 10•3 years ago
|
||
(In reply to Andrew McCreight [:mccr8] from comment #9)
For the tables that are swept as part of GC, if we can make them be GCHashMap then we can use WeakCache<GCHashMap> and have them swept in parallel with other things need updating. Probably not a huge win but nice to exploit if we can. But also it seems a nice tidyup to use the mozilla::HashMap API and remove the need to cast when iterating the maps etc.
The binary size is a good point, and something I hadn't considered. I measured this for clean release builds on linux and found that these changes decreased the size of libxul.so by 38KB, although I don't understand how.
Pre: -rwxr-x--- 1 jon jon 169309688 Sep 28 09:54 opt-build/dist/firefox/libxul.so
Post: -rwxr-x--- 1 jon jon 169271176 Sep 28 10:06 opt-build/dist/firefox/libxul.so
Assignee | ||
Comment 11•3 years ago
|
||
The latter header gets included in a whole bunch of places outside XPConnect,
and it's not necessary to include XPCMaps.h in it.
Depends on D126644
Comment 12•3 years ago
|
||
Pushed by jcoppeard@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/dc520dac1739 Part 1: Convert Native2WrappedNativeMap to use mozilla::HashMap r=mccr8 https://hg.mozilla.org/integration/autoland/rev/d21d9cac6ae6 Part 2: Convert IID2NativeInterfaceMap to use mozilla::HashMap r=mccr8 https://hg.mozilla.org/integration/autoland/rev/58d727381614 Part 3: Convert ClassInfo2NativeSetMap to use mozilla::HashMap r=mccr8 https://hg.mozilla.org/integration/autoland/rev/f8d7ce4f7508 Part 4: Convert ClassInfo2WrappedNativeProtoMap to use mozilla::HashMap r=mccr8 https://hg.mozilla.org/integration/autoland/rev/1dcdb11508ed Part 5: Convert NativeSetMap to use mozilla::HashSet r=mccr8 https://hg.mozilla.org/integration/autoland/rev/99dc0e64be7f Part 6: Convert XPCWrappedNativeProtoMap to use mozilla::HashMap r=mccr8 https://hg.mozilla.org/integration/autoland/rev/560ee149e587 Part 7: Remove XPCMaps.h include from xpcprivate.h r=mccr8
Comment 13•3 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/dc520dac1739
https://hg.mozilla.org/mozilla-central/rev/d21d9cac6ae6
https://hg.mozilla.org/mozilla-central/rev/58d727381614
https://hg.mozilla.org/mozilla-central/rev/f8d7ce4f7508
https://hg.mozilla.org/mozilla-central/rev/1dcdb11508ed
https://hg.mozilla.org/mozilla-central/rev/99dc0e64be7f
https://hg.mozilla.org/mozilla-central/rev/560ee149e587
Updated•3 years ago
|
Description
•