Hash table churn and resizing showing up in speedometer profiles
Categories
(Core :: CSS Parsing and Computation, enhancement)
Tracking
()
People
(Reporter: kats, Assigned: kats)
References
(Blocks 1 open bug)
Details
(Keywords: perf, Whiteboard: [fxpe])
There is a hashmap at https://searchfox.org/firefox-main/rev/f898416c560977636760a1fdab1d3f468cb62486/servo/components/style/properties/cascade.rs#715 which gets created, resized, and destroyed a lot, causing a lot of allocator calls which are expensive. It is showing up in speedometer profiles (e.g. https://profiler.firefox.com/public/tpccw18t6h8bnr14zcz6nb0b9cz9cbg9d4afkyg/calltree/?globalTrackOrder=0&invertCallstack&thread=0&transforms=fs-m--async%2C-sync~fs-m-SocialNetwork-React~ffs-js-102301&v=17)
We should be able to optimize this, I have some WIPs to persist it as a thread-local that are not good enough yet but do seem to validate the finding.
Updated•12 days ago
|
Updated•12 days ago
|
| Assignee | ||
Comment 2•8 days ago
|
||
I ended up writing a very direct patch to reuse this hash which is simple and easy to understand (but uses unsafe): https://hg-edge.mozilla.org/try/rev/70c54b1c09db6e20b21510f2ceeeb2f30b2e9c0f
Despite the hashbrown and memory allocation costs going down in the profile, there's no real end-to-end improvement on Speedometer: https://perf.compare/compare-results?baseRev=c66d60f30f0f692fa8622242c3b25743ae93ffa9&baseRepo=try&newRev=ec25ca0a6692b37a332d3108356877f8d34c9e48&newRepo=try&framework=13&advanced_columns=&advanced_expanded=&sort=median-diff%7Casc&initialized=1
Description
•