vile / bench / native / LOOPS-362-LOOP-TRIAL.md
70 lines · 56 sloc · 5.89 KB · 76646891b77a3d5c6af4a1e42b122cd61dc1654b
Raw

Native private named loops: loop-only trial (362)

Compiler-generated named-let wrappers can lower to private native locals. The existing nonescaping-helper proof checks every loop-procedure use. Eligible self tail calls move evaluated arguments and jump back to the loop entry, including calls through private binding helpers. Internal definitions reset on every iteration. Non-tail recursion, escaping or rebound loop procedures, unsupported operations and host budgets retain interpreter behavior.

Normalization removes only the exact compiler wrapper and adjusts lexical references in its descendants. The original VM bytecode remains unchanged for replay. No new VM operation, environment allocation or GC dependency is introduced. Native capture staging and vector rollback remain in force.

All 98 native cases passed freshly under ASan/UBSan and Boehm. The CLI checks, default-build budget regression, and both production collector builds passed. New coverage includes initializer order, nested and sequential loops, implicit Vile tail calls, pending non-tail work, per-iteration uninitialized locals, escaped/rebound self bindings, rollback after writes, and full-state interpreter comparisons for the actual WM focus/layout/scoring roots.

The same idle Intel i3 Mac mini ran all 24 runtime and 12 mock-WM workloads serially from hash-verified snapshots, separately from builds/tests. Retained361 and candidate362 each use arena/Boehm, alongside Guile 3.0.10 with unchanged guild-O2 wrappers and default JIT. All 1,800 comparison results passed: nine retained fresh processes plus one excluded sample per workload/configuration. All 144 cache-population observations are separate; all 1,440 native comparison processes compiled zero sources. Prepared medians exclude setup and first use; raw first-call and process durations remain available. All original workloads and oracles remain included.

All 26 scaling groups passed 4 versus 400 calls, three repetitions per count, with total-time ratios above 20 and zero native compilations. Completed samples are journaled in the same source/cache context.

Suite GC gain vs361 Arena gain vs361 Guile/new GC Guile/new arena
wm 1.294× 1.318× 0.436× 0.417×
numeric 1.043× 1.034× 0.578× 0.571×

Guile/Vile ratios above one favor Vile. The requested full 1.5× advantage remains unproven; the final 31-sample and full-objective gates are outstanding.

Regressions over 5% against361: numeric/bignum-fib-200 (gc, 1.081× elapsed); numeric/rational-harmonic-80 (gc, 1.072× elapsed); numeric/closure-mutate-2k (gc, 1.756× elapsed); numeric/closure-mutate-2k (arena, 1.926× elapsed); numeric/higher-order-2k (gc, 1.065× elapsed); numeric/higher-order-2k (arena, 1.102× elapsed). All losses remain in the tables and aggregates.

wm

Workload 361 GC ms 362 GC ms Guile ms GC gain vs361 Arena gain vs361
wm-callback-chain 0.603408 0.599775 0.637750 1.006× 1.032×
wm-event-dispatch 1.403566 0.969121 0.215500 1.448× 1.438×
wm-focus-cycle 3.465855 0.590939 0.377500 5.865× 6.125×
wm-tiling-layout 0.565690 0.310474 0.108750 1.822× 1.961×
wm-workspace-move 1.215270 1.146603 0.174000 1.060× 1.068×
wm-keybindings 4.377770 4.528939 0.279750 0.967× 1.025×
wm-hooks 2.393545 2.342619 0.359250 1.022× 1.011×
wm-lifecycle 1.258601 1.083804 0.130000 1.161× 1.182×
wm-macro-config 4.539519 4.548281 5.484000 0.998× 1.019×
wm-config-load-tree 5.080740 5.029925 8.975250 1.010× 1.011×
wm-reload-live 5.609709 5.126851 8.298000 1.094× 1.087×
wm-session-replay 5.630035 5.344977 8.017250 1.053× 1.053×

numeric

Workload 361 GC ms 362 GC ms Guile ms GC gain vs361 Arena gain vs361
tail-sum-10k 0.005617 0.005606 0.033670 1.002× 1.001×
fib-20 0.170221 0.146813 0.310750 1.159× 1.155×
closure-5k 0.002827 0.002170 0.015590 1.303× 1.119×
list-3k 0.007316 0.007315 0.059940 1.000× 1.001×
flonum-sum-2k 0.005707 0.002376 0.095583 2.402× 2.399×
bignum-fib-200 0.061881 0.066877 0.005417 0.925× 0.983×
rational-harmonic-80 0.097255 0.104306 0.051250 0.932× 0.995×
integer-divmod-5k 0.012379 0.007920 0.167917 1.563× 1.552×
list-map-1k 0.133988 0.133591 0.048667 1.003× 0.986×
list-reverse-2k 0.675978 0.673329 0.060750 1.004× 1.007×
vector-update-2k 0.070879 0.073175 0.016167 0.969× 0.983×
bytevector-fill-4k 1.021281 1.022350 0.086167 0.999× 1.000×
hashtable-count-1k 0.484095 0.492391 5.934167 0.983× 0.997×
string-build-1k 0.048637 0.048946 0.042583 0.994× 1.002×
string-scan-4k 1.054237 1.038315 0.043750 1.015× 0.992×
unicode-scan-1k 0.275138 0.274981 0.011750 1.001× 1.001×
datum-read-write-200 1.588215 1.549851 2.270875 1.025× 1.024×
closure-mutate-2k 0.003004 0.005275 0.008417 0.569× 0.519×
higher-order-2k 0.003836 0.004085 0.006333 0.939× 0.907×
callcc-escape-1k 0.125489 0.125578 0.006750 0.999× 0.996×
values-consumer-1k 0.728603 0.686846 0.004417 1.061× 1.001×
dynamic-wind-200 0.158453 0.159581 0.012500 0.993× 0.996×
goops-dispatch-1k 0.784161 0.779966 0.109125 1.005× 1.003×
goops-allocate-200 0.113305 0.113475 0.055000 0.998× 1.009×

Candidate binaries: vile-resume.hai8j_n2/loops362. Measurement snapshot: vile-resume.071w_i2f. Recovery archive: validation/loops362-loop-trial/.

This loop-only trial is not retained: captured-counter and higher-order regressions require investigation. The complete comparison is preserved here.