vile / bench / runtime / VALUES-400.md
129 lines · 108 sloc · 12.23 KB · 76646891b77a3d5c6af4a1e42b122cd61dc1654b
Raw

Multiple-values forwarding (400)

Tail values calls with at least two arguments can forward their handles directly to the immediate private call-with-values consumer. The existing stack buffer, finish_call API and iterative application loop replace a transient packet and its item-array clone. Dead handles still clear, captured environments retain their ownership, and forwarding preserves the bridge instruction and consumer application charges. The instruction-only bridge is shared; every Procedure still owns its original VM. No metadata fields, allocator or GC dependency were added. No compiler or standard-library source changed.

Only the ordinary dispatcher enables forwarding. Positive instruction budgets, external evaluation control, bounded owners and active native execution retain the original packet protocol. Options defaults to a one-million-step budget, so its default multiple-value packet protocol remains in use. The prepared comparisons below use unlimited steps, as in the frozen protocol; they do not establish the same gains under the default positive budget. Zero/one results and published/retained multiple-value results keep their original representation.

A fixed producer/consumer allocation regression retains about 12,433 bytes for 100 iterations and 1,121,233 bytes for 10,000 on retained394. This revision retains 1,233 and about 1,234 bytes in all four configurations: fixed entry storage instead of approximately 112 bytes per iteration. This separate allocation fixture is not substituted into the performance aggregate. The prepared values workload includes capturing closures and other work.

All 91 focused cases pass per ordinary/native sanitizer/Boehm configuration. Coverage includes aliases and live bindings, mutation, every budget/error/effect boundary, 300 arguments, captured producer/consumer continuations, 4,096 nested values consumers, rejection without mutation, dead handles and cross-VM ownership. One fixture initially assigned an immutable Options field; the test was corrected to replace the whole options value. Its 84 completed unaffected ordinary sanitizer cases were reused only after exact runtime/test/log hash checks; the corrected seven-test file reran. Other configurations ran all 91 cases. Four baseline probes pass in each configuration; no failing functional baseline is claimed. The measured baseline allocation exceeds the new bound.

Final qualification passes 420 ordinary and 349 native cases per sanitizer/Boehm mode, plus two CLI cases and one default-build budget case (1,541 checks). The original wrapper completed all four broad phases, then stopped because its snapshot omitted the CLI helper. A corrected same-source snapshot preserves every broad result and executes only the CLI/default checks; original and corrected job records are retained. Exact compatible focused groups were seeded into the full gate only with matching source and log hashes; new combinations compiled again. Every completed phase and checkpoint is preserved.

Actual production C for all four variants contains full-width indices and no packet/array creation or recursive consumer application in the forwarding helper. Existing closure entry, activation, finish_call, charging, push and file-return helpers match retained394 after narrowly normalizing generated discard identifiers. The shared application function adds one flag and the values-only branch. Controlled dispatch changes only an unconditional Result handoff scope and uses the false wrapper; independent single-step/internal entry also uses that wrapper. Layouts and old field offsets remain unchanged (Function: 368 bytes). C eligibility is not a speed result.

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 baselines are retained394. Each engine records 5,760 observations: 31 retained rounds plus uniformly excluded round0, with 144 separate preparations and 46 passing scaling groups. All 4,608 paired native hit/deopt observations match. Interpreted native/JIT counters are zero; warmup and measured processes compile no native code. Builds, tests, preparation, timing and analysis ran separately under the shared Mac lock from hash-verified snapshots.

This revision is retained for the allocation reduction and broad interpreted gains, with every loss included. Interpreted GC gains 1.2% overall and arenas 2.0%; the prepared values workload gains 40.5% and 23.9%. Native GC gains 0.9%; its arena estimate gains 0.3% with a confidence interval including parity. Equally weighted geometric means include every workload. Ratios above one favor candidate or Vile. Guile remains about five times faster than interpreted Vile overall; the full 1.5x goal is unmet. R7RS compatibility and first-use results remain separate, with no full R7RS performance aggregate claimed.

Known regressions remain material: interpreted GC continuation escape takes 22.1% longer and tail summation 26.4% longer. Native GC string scanning takes 8.4% longer and arena list mapping 5.2% longer. Their causes are unproven. Follow-up auditing found exact C matches for all nine numeric kernels, three selection helpers, checked arithmetic and the loop-fusion entry. Representative Subtract/Add address-normalized disassembly also matches; some CFGs remain unresolved and linear decoding includes non-code bytes. No whole-function instruction total or causal performance attribution is made.

Engine Suite GC gain vs394 Arena gain vs394 Guile/Vile GC Guile/Vile arena
interpreter wm 1.0144x 0.9957x 0.2702x 0.2626x
interpreter runtime 1.0107x 1.0331x 0.1753x 0.1720x
interpreter all36 1.0119x 1.0205x 0.2025x 0.1981x
native wm 1.0172x 1.0038x 0.6554x 0.6451x
native runtime 1.0051x 1.0030x 1.5332x 1.5804x
native all36 1.0091x 1.0032x 1.1550x 1.1723x

95% paired-round percentile bootstrap intervals use 2,000 deterministic resamples within each fixed workload, seed393031. 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.0112–1.0131x 1.0194–1.0215x 0.2023–0.2030x 0.1979–0.1985x
native 1.0081–1.0103x 0.9990–1.0077x 1.1536–1.1575x 1.1676–1.1747x

interpreter / wm

Workload 394 GC ms 400 GC ms Guile ms GC gain Arena gain
wm-callback-chain 4.430973 4.351208 0.640000 1.018x 0.999x
wm-config-load-tree 4.992604 4.942168 8.949500 1.010x 0.992x
wm-event-dispatch 2.771305 2.732734 0.215500 1.014x 0.991x
wm-focus-cycle 4.061997 4.023232 0.380000 1.010x 0.995x
wm-hooks 2.677940 2.639749 0.355750 1.014x 1.014x
wm-keybindings 1.116617 1.083907 0.280000 1.030x 1.001x
wm-lifecycle 0.968875 0.954459 0.127000 1.015x 1.000x
wm-macro-config 4.474293 4.442623 5.282250 1.007x 0.986x
wm-reload-live 7.135600 7.061589 8.143250 1.010x 0.994x
wm-session-replay 6.454001 6.373894 8.051750 1.013x 0.993x
wm-tiling-layout 1.751804 1.728111 0.109500 1.014x 0.989x
wm-workspace-move 1.204152 1.184382 0.177750 1.017x 0.995x

interpreter / runtime

Workload 394 GC ms 400 GC ms Guile ms GC gain Arena gain
bignum-fib-200 0.033483 0.032459 0.005417 1.032x 1.002x
bytevector-fill-4k 0.776183 0.731683 0.086083 1.061x 0.994x
callcc-escape-1k 0.007059 0.008621 0.006667 0.819x 1.324x
closure-5k 0.509327 0.502762 0.015590 1.013x 0.953x
closure-mutate-2k 0.276527 0.276860 0.008417 0.999x 0.981x
datum-read-write-200 1.188155 1.203985 2.269625 0.987x 0.989x
dynamic-wind-200 0.122783 0.122362 0.012583 1.003x 1.009x
fib-20 4.376009 4.295090 0.310970 1.019x 0.977x
flonum-sum-2k 0.486868 0.473939 0.096167 1.027x 1.009x
goops-allocate-200 0.080595 0.079648 0.054875 1.012x 1.027x
goops-dispatch-1k 0.733172 0.735204 0.110375 0.997x 1.027x
hashtable-count-1k 0.432462 0.414748 5.949083 1.043x 0.992x
higher-order-2k 0.351102 0.349461 0.006333 1.005x 0.977x
integer-divmod-5k 0.845671 0.813737 0.168083 1.039x 0.984x
list-3k 0.883159 0.855138 0.060330 1.033x 0.995x
list-map-1k 0.098681 0.099753 0.048583 0.989x 0.996x
list-reverse-2k 0.413128 0.414470 0.060667 0.997x 0.999x
rational-harmonic-80 0.093342 0.093328 0.049500 1.000x 1.002x
string-build-1k 0.041142 0.040353 0.042667 1.020x 0.998x
string-scan-4k 0.628411 0.605484 0.043750 1.038x 1.013x
tail-sum-10k 0.056202 0.071038 0.033700 0.791x 1.414x
unicode-scan-1k 0.169815 0.164346 0.011750 1.033x 1.021x
values-consumer-1k 0.597466 0.425374 0.004417 1.405x 1.239x
vector-update-2k 0.376824 0.372728 0.016250 1.011x 1.000x

native / wm

Workload 394 GC ms 400 GC ms Guile ms GC gain Arena gain
wm-callback-chain 0.485686 0.477272 0.638000 1.018x 0.989x
wm-config-load-tree 4.674870 4.636050 8.988250 1.008x 0.996x
wm-event-dispatch 0.813551 0.787733 0.219250 1.033x 1.009x
wm-focus-cycle 0.482988 0.474704 0.378500 1.017x 0.997x
wm-hooks 2.065677 2.005785 0.357500 1.030x 1.003x
wm-keybindings 0.933457 0.928515 0.279750 1.005x 1.023x
wm-lifecycle 0.862197 0.840825 0.125750 1.025x 1.011x
wm-macro-config 4.418045 4.389241 5.295750 1.007x 1.006x
wm-reload-live 4.841558 4.806727 8.140500 1.007x 1.003x
wm-session-replay 4.894510 4.850694 8.071250 1.009x 0.991x
wm-tiling-layout 0.265205 0.258729 0.109500 1.025x 1.011x
wm-workspace-move 0.190851 0.186793 0.176500 1.022x 1.005x

native / runtime

Workload 394 GC ms 400 GC ms Guile ms GC gain Arena gain
bignum-fib-200 0.043109 0.042292 0.005417 1.019x 1.005x
bytevector-fill-4k 0.080895 0.083261 0.086167 0.972x 1.010x
callcc-escape-1k 0.093437 0.090904 0.006667 1.028x 1.021x
closure-5k 0.002127 0.002128 0.015550 1.000x 1.000x
closure-mutate-2k 0.002857 0.002832 0.008417 1.009x 1.000x
datum-read-write-200 1.580630 1.598441 2.274625 0.989x 1.009x
dynamic-wind-200 0.000434 0.000435 0.012750 0.999x 0.997x
fib-20 0.146953 0.146927 0.313040 1.000x 0.997x
flonum-sum-2k 0.002382 0.002380 0.095750 1.001x 1.001x
goops-allocate-200 0.085849 0.083924 0.054750 1.023x 1.013x
goops-dispatch-1k 0.786129 0.765574 0.110375 1.027x 1.008x
hashtable-count-1k 0.455999 0.439846 5.966583 1.037x 1.013x
higher-order-2k 0.004069 0.004067 0.006333 1.000x 1.000x
integer-divmod-5k 0.007937 0.007918 0.168083 1.002x 1.000x
list-3k 0.007207 0.007211 0.060180 0.999x 1.001x
list-map-1k 0.136800 0.133343 0.048583 1.026x 0.951x
list-reverse-2k 0.068894 0.068289 0.060750 1.009x 1.001x
rational-harmonic-80 0.104989 0.103610 0.049500 1.013x 1.007x
string-build-1k 0.044939 0.044170 0.043000 1.017x 1.006x
string-scan-4k 0.087614 0.094937 0.043750 0.923x 1.035x
tail-sum-10k 0.005607 0.005605 0.033650 1.000x 1.000x
unicode-scan-1k 0.035594 0.035596 0.011750 1.000x 1.003x
values-consumer-1k 0.001558 0.001553 0.004417 1.003x 1.000x
vector-update-2k 0.060878 0.059082 0.016167 1.030x 0.996x

Build: vile-resume.p1lvvcpw. Final gate: vile-resume.t1b51ive. Preparation/measurement: vile-resume.o_zg1o23. Recovery: validation/values-forward400/. Source/patch, all production binaries/C/ASM/CFGs, raw matrices and caches, frozen inputs, allocation records, baseline/focus/full logs, reuse proofs and failed fixture evidence are preserved.