vile / bench / runtime / KERNELS-394.md
125 lines · 106 sloc · 10.51 KB · 76646891b77a3d5c6af4a1e42b122cd61dc1654b
Raw

Typed integer recurrence kernels (394)

Two arithmetic operations are selected once at the existing guarded closure-entry transition. Nine typed kernels reuse checked addition, subtraction and multiplication without a shared operation switch inside each recurrence iteration. Both updates read the old parameters; only complete iterations commit, preserving all 19 virtual instruction charges and the original overflow/budget fallback. Compilation metadata, Function layout, live binding/ownership/control guards, the common interpreter dispatcher and native admission are unchanged from retained 391.

Checked multiplication also uses V’s existing math.bits.mul_64 API (measured separately as 393). It preserves the full signed range and promotes on overflow. The standalone 393 trial was flat for interpreted GC overall and is not retained alone; this combined refinement improves the primary interpreted comparison. No compiler or standard-library source changed.

Actual production C for both engines and collectors contains stack scalar state and borrowed fixed-six operands. The two fixed-array initialization statements at entry exactly match393. All nine recurrence kernels allocate and copy nothing, use no generic array get/set, and make no VM application/activation/dispatch calls. All nine noinline kernels are emitted in each binary. nm-bounded LLVM assembly and CFG evidence is archived. Unresolved switch CFGs carry no exact executable totals; favorable code generation alone is not treated as a speed result.

All 63 focused cases pass in ordinary/native builds under ASan/UBSan and Boehm. New coverage checks all nine operation pairs, both branch polarities, simultaneous results, first-parameter product overflow and selected instruction budgets against single-step observations. That new semantic test also passes on unchanged 393 in all four configurations; no failing functional baseline is claimed. The independent6,869 Python-product fixtures and existing numeric/entry/admission tests remain included. Final qualification passes 413 ordinary and 342 native cases per mode, plus two CLI cases and the default-build budget check.

Both complete comparisons use the same idle Intel Mac mini, Guile 3.0.10 with guild -O2/default JIT, all 24 runtime and 12 mock-WM workloads, both collectors, frozen four-input oracles, original batches and five warmups. Both engine baselines are retained 391. Each engine records 5,760 observations: 31 retained rounds plus uniformly excluded round 0. Separate preparation records 144 runs per engine. All 92 scaling groups pass 4 versus 400 calls with at least 20x elapsed growth. All 4,608 paired native hit/deopt observations match. Interpreted native/JIT counters are zero; no warmup or measured process compiles native code. Builds, tests, preparation, timing and analysis run separately and serially under the shared Mac lock from hash-verified snapshots.

This revision is retained for the interpreted gain, including every native loss below. Aggregates are equally weighted geometric means over every workload. Ratios above one favor candidate or Vile. Guile remains about 5x faster than interpreted Vile overall; the full 1.5x goal remains unmet. R7RS compatibility/first-use results remain separate, with no full R7RS timing aggregate claimed.

Engine Suite GC gain vs391 Arena gain vs391 Guile/Vile GC Guile/Vile arena
interpreter wm 1.0111x 1.0204x 0.2661x 0.2631x
interpreter runtime 1.0546x 1.0397x 0.1736x 0.1666x
interpreter all36 1.0399x 1.0333x 0.2002x 0.1940x
native wm 1.0049x 1.0061x 0.6455x 0.6440x
native runtime 1.0041x 1.0024x 1.5208x 1.5751x
native all36 1.0044x 1.0036x 1.1429x 1.1691x

Interpreted GC improves 4.0% overall; arenas improve 3.3%. Tail summation improves 1.884x with GC and 1.346x with arenas; the numeric loop inside call/cc escape improves 1.667x and 1.370x. No interpreted workload/collector loses more than 5%. Native GC/arena estimates improve 0.44%/0.36%; the native GC confidence interval includes parity. Native closure-5k with GC takes 8.2% longer. That regression remains included in every aggregate; unchanged native decisions and counters do not establish its cause.

95% paired-round percentile bootstrap intervals use 2,000 deterministic resamples within each fixed workload, seed 393031. They describe observed process variation, not unseen-program performance.

Engine GC gain interval Arena gain interval Guile/Vile GC interval Guile/Vile arena interval
interpreter 1.0388–1.0408x 1.0320–1.0343x 0.1998–0.2005x 0.1937–0.1944x
native 0.9992–1.0082x 1.0021–1.0091x 1.1367–1.1473x 1.1655–1.1718x

interpreter / wm

Workload 391 GC ms 394 GC ms Guile ms GC gain Arena gain
wm-callback-chain 4.532754 4.424601 0.637750 1.024x 1.040x
wm-config-load-tree 4.979763 4.982615 9.006500 0.999x 1.000x
wm-event-dispatch 2.784497 2.769290 0.215750 1.005x 1.019x
wm-focus-cycle 4.137319 4.063511 0.379000 1.018x 1.021x
wm-hooks 2.750920 2.677027 0.355750 1.028x 1.027x
wm-keybindings 1.130125 1.116638 0.280500 1.012x 1.022x
wm-lifecycle 0.981680 0.970403 0.127500 1.012x 1.022x
wm-macro-config 4.482078 4.475193 5.275750 1.002x 1.001x
wm-reload-live 7.129514 7.110889 8.144000 1.003x 1.010x
wm-session-replay 6.456318 6.482971 8.079250 0.996x 1.031x
wm-tiling-layout 1.759246 1.750344 0.109000 1.005x 1.019x
wm-workspace-move 1.241566 1.205594 0.174500 1.030x 1.034x

interpreter / runtime

Workload 391 GC ms 394 GC ms Guile ms GC gain Arena gain
bignum-fib-200 0.033174 0.033582 0.005500 0.988x 1.015x
bytevector-fill-4k 0.767440 0.776634 0.086167 0.988x 1.023x
callcc-escape-1k 0.011745 0.007047 0.006667 1.667x 1.370x
closure-5k 0.510823 0.509541 0.015580 1.003x 1.020x
closure-mutate-2k 0.276331 0.276817 0.008417 0.998x 1.004x
datum-read-write-200 1.207928 1.185515 2.269000 1.019x 1.025x
dynamic-wind-200 0.124864 0.122607 0.012667 1.018x 1.007x
fib-20 4.495523 4.376724 0.310900 1.027x 1.020x
flonum-sum-2k 0.472111 0.486615 0.095833 0.970x 1.019x
goops-allocate-200 0.080750 0.080638 0.054875 1.001x 0.993x
goops-dispatch-1k 0.738212 0.733521 0.110375 1.006x 0.994x
hashtable-count-1k 0.432705 0.432833 5.958667 1.000x 1.011x
higher-order-2k 0.352057 0.350688 0.006333 1.004x 1.007x
integer-divmod-5k 0.835663 0.845737 0.168167 0.988x 1.010x
list-3k 0.869331 0.882618 0.060180 0.985x 1.015x
list-map-1k 0.109061 0.098834 0.048500 1.103x 1.061x
list-reverse-2k 0.430705 0.413443 0.060833 1.042x 1.049x
rational-harmonic-80 0.094838 0.093113 0.049750 1.019x 1.011x
string-build-1k 0.041043 0.041013 0.043167 1.001x 0.992x
string-scan-4k 0.618110 0.627585 0.043750 0.985x 1.009x
tail-sum-10k 0.106550 0.056557 0.033680 1.884x 1.346x
unicode-scan-1k 0.167858 0.169917 0.011750 0.988x 1.016x
values-consumer-1k 0.595771 0.596861 0.004417 0.998x 1.010x
vector-update-2k 0.381059 0.377582 0.016167 1.009x 1.016x

native / wm

Workload 391 GC ms 394 GC ms Guile ms GC gain Arena gain
wm-callback-chain 0.481054 0.484146 0.638500 0.994x 1.003x
wm-config-load-tree 4.670174 4.664510 9.002750 1.001x 1.006x
wm-event-dispatch 0.825823 0.815307 0.215500 1.013x 1.016x
wm-focus-cycle 0.481905 0.483936 0.378500 0.996x 0.995x
wm-hooks 2.086992 2.064298 0.356000 1.011x 1.008x
wm-keybindings 0.952567 0.932762 0.282000 1.021x 1.006x
wm-lifecycle 0.876868 0.860029 0.126500 1.020x 1.017x
wm-macro-config 4.421483 4.430163 5.287250 0.998x 1.002x
wm-reload-live 4.843813 4.841325 8.155750 1.001x 1.010x
wm-session-replay 4.890216 4.897553 8.122500 0.999x 1.009x
wm-tiling-layout 0.265579 0.265499 0.113500 1.000x 1.006x
wm-workspace-move 0.192488 0.191342 0.174000 1.006x 0.995x

native / runtime

Workload 391 GC ms 394 GC ms Guile ms GC gain Arena gain
bignum-fib-200 0.043263 0.043082 0.005417 1.004x 1.005x
bytevector-fill-4k 0.080450 0.080988 0.086083 0.993x 1.015x
callcc-escape-1k 0.094871 0.093720 0.006667 1.012x 1.017x
closure-5k 0.002129 0.002303 0.015570 0.925x 1.000x
closure-mutate-2k 0.002857 0.002832 0.008500 1.009x 1.003x
datum-read-write-200 1.596699 1.581719 2.265875 1.009x 1.019x
dynamic-wind-200 0.000433 0.000436 0.012583 0.992x 1.000x
fib-20 0.147041 0.146978 0.310850 1.000x 0.995x
flonum-sum-2k 0.002380 0.002373 0.095667 1.003x 1.000x
goops-allocate-200 0.086334 0.085866 0.054875 1.005x 1.007x
goops-dispatch-1k 0.795280 0.786892 0.109500 1.011x 1.004x
hashtable-count-1k 0.459309 0.456417 6.017417 1.006x 1.010x
higher-order-2k 0.004070 0.004072 0.006333 0.999x 1.000x
integer-divmod-5k 0.007929 0.007927 0.168083 1.000x 1.000x
list-3k 0.007210 0.007206 0.059760 1.001x 1.000x
list-map-1k 0.137392 0.137010 0.048583 1.003x 1.014x
list-reverse-2k 0.067472 0.068616 0.060583 0.983x 1.005x
rational-harmonic-80 0.105941 0.104742 0.050250 1.011x 1.009x
string-build-1k 0.045147 0.045095 0.043083 1.001x 0.993x
string-scan-4k 0.098325 0.087635 0.043750 1.122x 0.994x
tail-sum-10k 0.005606 0.005608 0.033670 1.000x 1.000x
unicode-scan-1k 0.035592 0.035590 0.011750 1.000x 0.983x
values-consumer-1k 0.001558 0.001556 0.004417 1.001x 0.999x
vector-update-2k 0.061911 0.060892 0.016250 1.017x 0.988x

Build: vile-resume.ugne7wma. Final gate: vile-resume.7l5uqt02. Preparation/measurement: vile-resume.01jgex35. Recovery: validation/integer-kernel394/. Raw samples, scaling, first-call/process observations, caches, frozen inputs, source/compiler/binary hashes, generated C/ASM/CFGs and successful/failed helper job records are preserved.