Commit 92044a6
committed
css: optimize CssPropertyCache - replace BTreeMaps with sorted Vecs
Major performance optimization (~34% faster StyledDom::create) by
converting CssPropertyCache from BTreeMap-heavy to sorted Vec storage
with binary search lookups:
- Remove CssDependencyChain and dependency_chains field entirely
- Convert user_overridden_properties: BTreeMap to sorted Vec
- Convert computed_values: BTreeMap to sorted Vec
- Remove resolved_cache field, use compact_cache.tier3_overflow instead
- Sort css_props/cascaded_props by (state, prop_type) for binary search
- Replace O(n^2) apply_ua_css with bitset-based approach
- Add PartialOrd/Ord to PseudoStateType for sorted stateful properties
- Rewrite get_element_font_size to use computed_values (fix recursion)
- Update compact_cache_builder to populate tier3_overflow
Benchmark: StyledDom::create 9.3s to 6.2s on deserialize.rs test case.1 parent d90cf10 commit 92044a6
6 files changed
Lines changed: 302 additions & 632 deletions
File tree
- core/src
- css/src
- layout/src/solver3
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | | - | |
27 | | - | |
28 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
29 | 35 | | |
30 | 36 | | |
31 | 37 | | |
| |||
384 | 390 | | |
385 | 391 | | |
386 | 392 | | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
387 | 405 | | |
388 | 406 | | |
389 | 407 | | |
| |||
0 commit comments