Repository navigation
Merged
Conversation
Keep the full native pointer and pack size plus allocator alignment into one metadata word on 64-bit hosts. Records shrink from 24 to 16 bytes, reducing side-table storage, growth copies and sweep movement. Preserve the full 32-bit size range and reject unrepresentable 64-bit cells before allocation. Trigger policy, payload charging and sweep order are unchanged. Zig 0.16.0, ReleaseSafe with -Dwasm. Interleave baseline, candidate and bb, five runs after a warm-up, pinned to CPU 3 in the same window. RSS is the largest per-process peak among the five runs, time the best INPROC_MS. Metric Before After bb Churn in-process ms 1375 1350 1001 Churn peak RSS KiB 165140 147764 176488 Median user instructions, B 6.843 6.821 5.320 Repeated windows confirm about 17 MiB less peak RSS. Throughput is not a proven gain and remains 1.30 to 1.53 times bb. This is partial progress, not completion of CLJW-PERF-GC-CHURN. The historical 353 MB card baseline predates O-091, which is already on this branch base. Rerun all 15 timed vs_bb workloads and seven native collection/GC workloads. Recheck apparent slowdowns in separate interleaved windows. No repeatable regression established; shared-host timing remains noisy. Keep raw samples and caveats in bench/vs_bb/gc_records.yaml and gc_records.md. Cover full pointer/size/alignment roundtrips, pre-allocation refusal and exact frees through sweep and live deinit. Discard the inherited forward sweep experiment because repeated timing windows did not justify it. Validation: zig build test -Dwasm -j2 passed. Final smoke with GC torture passed 17 steps, 5515 corpus outputs and 986 Clojure tests/5235 assertions. Zlinter was unavailable offline and skipped. Smell-audited: 1: Compact shared metadata only; preserve allocator identity and collector semantics, with explicit bounds and free-metadata tests.
…llees once Two levers on the reduce/transduce path, both neutral-to-small and neither reaching the 15% bar. Kept because both are correct and measurably non-worse. 1. op_call's flatten gate required !m.has_rest, so a VARIADIC callee always fell to the host vt.callFn re-entry. When a call supplies exactly the method's required arity the .wrap binder's rest loop runs zero times and & rest binds nil, so there is no rest-pack to exclude and flattening is provably identical. That is the shape comp produces at its call sites ((fn* [& args] (f (apply g args)))), which is what a transduce reducing fn is. Rest-method frames now flatten instead of re-entering host eval. 2. invokeCallable resolved nothing: it re-ran treeWalkCall's whole prologue (consult-env save/set/restore, updateTopFrame, the calleeFrame switch, the callee-tag switch, selectMethod's scan) for every element of every native HOF loop. A .fn_val whose method is known now enters through tree_walk.callMethodResolved, which reproduces those observable effects and binds + runs the frame through the SAME binder the generic path reaches (F-011), so the two activation paths cannot drift. reduce's range and vector fast arms hoist the resolution out of the element loop. Semantics unchanged and verified against the baseline binary on the exact paths touched: variadic called at exact arity binds nil rest, comp-composed fns, transduce early termination via reduced?, an exception crossing a flattened variadic frame, dynamic bindings, 500-deep recursion, arity errors. Before/after, min-of-5 in-process ms, same host window as a baseline build of the same commit (both binaries ReleaseSafe -Dwasm): reduce_map 3809 -> 3649 (-4.2%) transduce 2551 -> 2375 (-6.9%) Load-independent instructions:u on reduce_map 29.5-35.9 G before, 24.2-35.3 G after (overlapping); transduce 31.3-33.6 G before, 23.7-31.6 G after. Neighbouring benches within noise (lazy_chain 1202 -> 1204, into_collections 2499 -> 2938, numeric_doubles 858 -> 695, vector_assoc 868 -> 1315). zig build test -Dwasm passed (zig_build_test_vm step, 267s). Below the card's 15% threshold on both benches, so no PR is opened. Smell-audited: 0-4: no new smell introduced; the new entry points are thin forwarders that reuse the existing single-source binder rather than re-deriving the activation layout.
… comp WORK IN PROGRESS, not for merge. Preserved from ling cljw-transduce-fused (gpt-6.1) when its session ended before it committed. Native reducing-function objects for (map f), (filter pred), (remove pred), (take n) and their comp, with a native suite test/clj/suites/native_transducer_test.clj. Same-window interleaved measurements (in-process ms, instructions:u): - transduce: 3224 -> 1120 ms (bb 361); 28.82 G -> 11.21 G instructions. - legacy_transduce: 228 -> 138 ms; into_transient_checks 112 -> 87 ms. - reduce_map: 4088 -> 4304 ms in window 2 (no gain; noise-level). - lazy_chain, into_collections, vector_assoc, gc_large_heap within noise. Open before a PR: the GC torture run failed once with "swap!: expected atom, got ref" (torture97-tests exit 1; the retry exited 0). Find whether a native stage leaks a ref where an atom is expected under GC pressure, then rerun zig build test -Dwasm, all native suites and the torture smoke. Smell-audited: 1: WIP preserved with its open torture failure stated, not proposed for merge.
perf(gc): compact allocation records to reduce churn metadata
Measured c4f3909 (merged with staging d211764) against staging d211764, both ReleaseSafe -Dwasm, pinned to one P-core, instructions:u per run. transduce 28.820 G -> 27.461 G (-4.71%), reduce_map 29.282 G -> 28.723 G (-1.91%), every sample of each arm identical to 0.1%. No bench/vs_bb workload regressed by more than 0.36% (protocol_dispatch). Wall time on this shared host spread up to 107% per arm, so instructions are the claim. Raw samples: bench/vs_bb/reduce_vm_step.yaml.
Verifies the native map, filter, remove and take transducer stages (O-111) against origin/staging 6c91f00 and records the samples. - bench/vs_bb/history.yaml: two interleaved best-of-5 rounds per side, ReleaseSafe -Dwasm, host load 38-67. Rows for 6c91f00 are the baseline binary; rows for f8faf0e are this branch. - Pinned (taskset -c 2, cpu_core instructions:u, 5 samples per side, interleaved): transduce 28.820G -> 11.208G (-61.1%), 10351 -> 4345 ms. No other workload moved by more than +0.7% in instructions. - .dev/optimizations.md: O-111 sat after a blank line, outside the table; it now continues the table. The GC torture flake the WIP commit recorded did not reproduce: six consecutive phase16_gc_torture runs and the smoke gate's run passed.
Keeps both sides. CHANGELOG.md: the native transducer stage entry and the GC allocation record entry both stay under [Unreleased] / Changed. .dev/optimizations.md: O-111 and O-092 both continue the table. Smell-audited: 0: merge only; no source line changed beyond the two sides.
perf(vm): flatten variadic calls at exact arity, resolve reduce callees once
Keeps both sides of invokeCallable: native transducer closures (O-111) dispatch through native_call first, then a fixed-arity .fn_val takes #132's resolved path (O-064). resolveFixedArity now returns null for a native closure. #132's reduce range and vector arms call it directly; a native map stage carries a variadic arity stub with no body, which the resolved binder would otherwise run instead of native_call. Smell-audited: 1: two-line guard plus conflict resolution, both behaviours kept.
bash scripts/gen_placement.sh after the O-111 stages. The only change is the four new Zig builtins cljw.internal/__map-xform, __filter-xform, __remove-xform and __take-xform (total 1472 -> 1476, zig 438 -> 442). check_placement_status, check_core_surface, check_doc_coverage and check_capability_claims pass locally.
perf(transduce): native map, filter, remove and take transducer stages (O-111)
This was referenced Dec 1, 2026
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.
Promotes staging to main, which cuts the next patch release (v1.15.9).
Three performance changes, each measured as pinned-core instruction counts against its base, ReleaseSafe with
-Dwasm:map,filter,removeandtaketransducer stages (perf(transduce): native map, filter, remove and take transducer stages (O-111) #133):transduce28.82 G to 11.21 G instructions (-61.1%),into_map_only-11.8%, no workload more than +0.7%. New suitenative_transducer_test.clj(14 tests, 158 assertions) passes on the JVM oracle, the VM and tree-walk.reduceover a range or vector resolves a fixed-arity reducing fn once (perf(vm): flatten variadic calls at exact arity, resolve reduce callees once #132):transduce-4.71%,into_collections-2.72%,reduce_map-1.91%, worst regression +0.36%.The CHANGELOG entries are under
[Unreleased]and are stamped by the release preflight.Not in this release: the move to Zig 0.17.1 and zwasm v2.12.1 (branch
chore/zig-0.17.1), which follows as its own PR.