Repository navigation
core: recover blitz beta.5 memory regressions and pool node allocations - #259
Open
BernardoPe wants to merge 1 commit into
Open
BernardoPe wants to merge 1 commit into
BernardoPe wants to merge 1 commit into
Conversation
Fixes the ElementData (+8 B) and TextLayout (+8 B) size regressions from the blitz 0.3.0-beta.5 upgrade and reduces retained memory and allocator traffic on large documents. - Move presentational_hints from ElementData into ElementRare gated on may_have_hints (ElementData 64 -> 56 B on wasm32) - Gate content_box_subpixel_offset on the writing-mode feature on TextLayout (52 -> 44 B on wasm32), ListItemLayout, and TextInputData - Compact LayoutData (shared order, [f32; 4] scrollable_overflow, lazy pooled unrounded layout when it differs from rounded) - Pool TextLayout, EvictedLayout, EvictedBreak, single-attribute Attributes (1-word tagged pointer), and taffy CacheInner in 64 KiB chunks that free automatically when live count returns to zero Cold single-page release benchmarks (d554baf -> patched): - ecma262-raw: peak 95.84 -> 89.98 MiB (-5.86 MiB), allocs -220,798 (-9.2%) - htmlstd-raw: peak 184.65 -> 172.28 MiB (-12.37 MiB), allocs -479,858 (-9.4%) Signed-off-by: bpereira <bpereira@cloudflare.com>
BernardoPe
requested review from
LuisDuarte1,
celso,
jonnyparris and
ruifigueira
as code owners
November 27, 2026 20:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
blitz0.3.0-beta.5 upgrade added 8 bytes to everyElementDataand everyTextLayout. This removes both regressions and cuts retained memory andallocator traffic on large documents.
How
presentational_hintsfromElementDataintoElementRare, gated onmay_have_hints.ElementDatadrops 64 -> 56 B on wasm32.content_box_subpixel_offseton thewriting-modefeature.TextLayoutdrops 52 -> 44 B on wasm32;
ListItemLayoutandTextInputDatashrink too.LayoutData: sharedorder,[f32; 4]scrollable_overflow, and apooled
unroundedlayout allocated only when it differs fromrounded.Attributesinto a tagged one-word slot, and poolTextLayout,EvictedLayout,EvictedBreakandtaffy::CacheInnerin64 KiB chunks that deallocate when the pool empties.
Testing
bazel test //:checkpasses 33/33, with JS/Rust lint, format and workspacechecks.
kitesurf-corelib tests pass 1,087/1,087,taffycache tests 21/21,and the wasm32 build and
taffyno_stdbuild compile clean.Cold single-page release runs, baseline -> this branch:
ecma262-raw: peak 95.84 -> 89.98 MiB, 220,798 fewer allocations (-9.2%).htmlstd-raw: peak 184.65 -> 172.28 MiB, 479,858 fewer allocations (-9.4%).Resolve latency is flat or faster. Not run locally: the E2E, Playwright,
Puppeteer and WPT lanes, and a
writing-mode-enabled build.Risk
scrollable_overflownarrows fromf64tof32, about 1e-3 px at 65k px. Nocode compares overflow coordinates for exact equality.
Attributestags aThinVecpointer in its low bit, which assumes the headerstays 2-byte aligned. Unit tests and a 400k-operation sanitizer run cover the
transitions.
MODULE.bazel.lockrevert the change cleanly.