Repository navigation
perf(eval): skip the ReleaseSafe 0xAA fill of per-call scratch windows (O-064) - #83
Merged
Merged
Conversation
…s (O-064) ReleaseSafe fills every `= undefined` local with 0xAA. The TreeWalk frame locals, call args, arg locations, recur and constructor buffers ([MAX_LOCALS]Value, ~2 KB each) and the VM handler stack were memset on every Clojure fn call: 19% of instructions in (reduce + (map * xs xs)). Each user reads only a prefix it has just written, so the poison catches nothing there. `tree_walk.uninitScratch` turns runtime safety off only for the returned undefined in non-Debug modes; Debug keeps the poison. User instructions, ReleaseSafe -Dwasm, taskset -c 2 (P-core), min of 2-3 runs, origin/staging -> this commit: (println 1) startup 74.2M -> 66.9M -10% 40 seq_dot_1k 16.02G -> 13.15G -18% 41 seq_dot_100k 16.86G -> 13.74G -18% 13 lazy_chain -38% 19 multimethod_dispatch -35% 27 gc_large_heap -50% 45 byte_array_from_seq 2.66G -> 2.23G -16% No cell of 01-39 regressed (worst +2.4%, one run, edn_roundtrip). Card: CLJW-PERF-UNDEFINED-SCRATCH (20261022012239-6f906811). Knowledge: 20261022011049-02b6329c.
BuddhiLW
added a commit
that referenced
this pull request
Oct 22, 2026
tree_walk.zig: #83 (O-064 uninitScratch) and this branch (O-080 safety-off wrapper) both removed the ReleaseSafe 0xAA fill of the callMethod locals buffer. Kept this branch's callMethodImpl/callMethodBody split, with the buffer now taken from uninitScratch: one mechanism for per-call scratch. O-080 ledger row updated to match. data/placement.yaml regenerated. Smell-audited: 2: duplicate mechanism removed at merge, ledger amended
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.
ReleaseSafe fills every
= undefinedlocal with 0xAA. The TreeWalk framelocals, call args, arg locations, recur and constructor buffers
([MAX_LOCALS]Value, ~2 KB each) and the VM handler stack were memset on
every Clojure fn call: 19% of instructions in (reduce + (map * xs xs)).
Each user reads only a prefix it has just written, so the poison catches
nothing there.
tree_walk.uninitScratchturns runtime safety off only forthe returned undefined in non-Debug modes; Debug keeps the poison.
User instructions, ReleaseSafe -Dwasm, taskset -c 2 (P-core), min of 2-3
runs, origin/staging -> this commit:
(println 1) startup 74.2M -> 66.9M -10%
40 seq_dot_1k 16.02G -> 13.15G -18%
41 seq_dot_100k 16.86G -> 13.74G -18%
13 lazy_chain -38%
19 multimethod_dispatch -35%
27 gc_large_heap -50%
45 byte_array_from_seq 2.66G -> 2.23G -16%
No cell of 01-39 regressed (worst +2.4%, one run, edn_roundtrip).
Card: CLJW-PERF-UNDEFINED-SCRATCH (20261022012239-6f906811).
Knowledge: 20261022011049-02b6329c.