perf(core): cut peak live memory 17.3% (taffy capacity, MeasureCtx dedupe) - #356
perf(core): cut peak live memory 17.3% (taffy capacity, MeasureCtx dedupe)#356quake wants to merge 1 commit into
Conversation
ee2e5e0 to
4983fac
Compare
4983fac to
23e06a7
Compare
|
Thanks for the optimization work. Removing the duplicated data from My main concern is that the current benchmark measures live bytes using the host allocator, while the actual PSP constraint is the arena high-water mark. The benchmark also includes some allocations from the test harness itself, so the current results are not enough to show that rebuilding and resizing the Taffy tree on every structural relayout is a net improvement on PSP. There are also a few unrelated or incomplete benchmark artifacts in this PR, along with some inconsistencies between the benchmark code and its comments. I suggest splitting the work: merge the low-risk deduplication and clone removal first, then fix the benchmark and provide PPSSPP/PSP For now, I’m requesting changes. |
|
I have narrowed this PR to the two low-risk core changes:
The Taffy storage rebuild will be proposed in a separate PR after adding PSP/PPSSPP |
96b3e96 to
553d0fd
Compare
Summary
Cuts
pocketjs-corepeak live memory 1,429,840 -> 1,182,457 bytes (-17.3%) on the new deterministicmembenchjourney, with zero behavior change (drawlist checksum byte-identical, 127 tests pass, wasm32 no_std build clean).MeasureCtx.textduplicate of every text runMeasureCtxto the shaped size; drop per-level children clones incollect_subtree/collect_runengine/core/examples/membench.rsis the new counting-allocator benchmark (boot -> steady -> churn -> burst; printsPEAK_LIVE_BYTES).Allocation-churn trade-off (measured)
Structural rebuilds now re-allocate the taffy maps instead of reusing historical capacity:
TOTAL_ALLOC_BYTESALLOC_COUNTThe +3.3 MB of total allocation bytes is a handful of large blocks per structural rebuild (recycled by the PSP arena's O(1) size-class free lists); the allocation count goes down.
Benchmark integrity
NODESreports the true live node count via a harness-side hierarchy model mirroringUi::destroy_node's subtree semantics (a call-counting counter drifted by +35 after churn).DRAWLIST_CHECKSUMis byte-identical across baseline and head.Note on CI
Workflow runs on this fork PR require maintainer approval (
action_required); the numbers above are local runs ofcargo test,cargo run --example membench, andcargo build --target wasm32-unknown-unknown, reproducible with the commands in the diff.