mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 02:27:19 +02:00
Each NodeWithStyle is assigned a sequential layout index during the pre-layout tree traversal. LayoutState stores UsedValues in a PagedStore — a two-level page table indexed by layout_index that gives O(1) lookup via two array accesses, with pages allocated lazily on first write. UsedValues are stored directly in pages (Optional<T>) rather than behind heap pointers, eliminating per-entry malloc/free calls and improving cache locality. This cuts ensure_used_values_for() from ~14% to ~7% in profiles on https://www.nyan.cat/.
37 KiB
37 KiB