Page MenuHomePhabricator

Bug 1874050 - Share more memory in custom property storage. r=dshin,#style,#layout
ClosedPublic

Authored by emilio on Jan 11 2024, 6:33 PM.
Referenced Files
Unknown Object (File)
Nov 13 2025, 1:10 PM
Unknown Object (File)
Nov 8 2025, 9:23 AM
Unknown Object (File)
Nov 7 2025, 2:50 AM
Unknown Object (File)
Nov 4 2025, 9:48 AM
Unknown Object (File)
Nov 3 2025, 3:08 AM
Unknown Object (File)
Nov 2 2025, 6:38 PM
Unknown Object (File)
Oct 16 2025, 10:03 AM
Unknown Object (File)
Aug 6 2025, 12:46 AM

Details

Summary

This implements a similar optimization as WebKit's, see the bug comment.
This should be specially useful for sites with lots of custom
properties.

This is a high-confidence win on this speedometer subtest:

  • 1.9x faster in style updates.
  • 4.2x faster in layout object destruction (we no longer free the huge custom properties map).
  • Also speeds up paint and layout a bit, probably from less memory churn.

Event Timeline

phab-bot changed the visibility from "Custom Policy" to "Public (No Login Required)".
phab-bot changed the edit policy from "Custom Policy" to "Restricted Project (Project)".
phab-bot removed a project: secure-revision.
bgrins added inline comments.
servo/components/style/custom_properties_map.rs
28

Is this comment and bug link out of date now? It seems like the code is using the fixed version in https://github.com/bluss/indexmap/issues/153#issuecomment-1678106160.

emilio edited the summary of this revision. (Show Details)

Remove dependency on indexmap update

dshin added inline comments.
servo/components/style/custom_properties_map.rs
64

Breaking 255 ancestor limit is probably hard/uncommon, but doesn't seem... impossible

This revision is now accepted and ready to land.Jan 12 2024, 5:49 PM

This revision requires a Testing Policy Project Tag to be set before landing. Please apply one of testing-approved, testing-exception-unchanged, testing-exception-ui, testing-exception-elsewhere, testing-exception-other. Tip: this Firefox add-on makes it easy!

emilio added inline comments.
servo/components/style/custom_properties_map.rs
64

We have a limit for how long we go (ANCESTOR_COUNT_LIMIT)

servo/components/style/custom_properties_map.rs
64

Oh I see increment on Line 204 is behind should_expand_chain which exits if the count is at or above ANCESTOR_COUNT_LIMIT