vile / bench / native / VALUES-365-INITIAL-TRIAL.md
71 lines · 57 sloc · 6.96 KB · 76646891b77a3d5c6af4a1e42b122cd61dc1654b
Raw

Private multiple-value callbacks (365): initial trial

Immediate private call-with-values producers and fixed-arity consumers can now lower to existing native locals and jumps. Zero through eight explicit values and ordinary scalar producers retain their original evaluation order. Producer exits supply consumer parameters directly, without allocating callback closures or multiple-value bundles on every iteration. Nested calls preserve pending operands and tail contexts; internal definitions reset on each activation.

The existing constructor CFG proof checks every use of the callbacks and control operators. It resolves actual global or hygienic bindings, recognizes the environment-free values procedure and complete internal call-with-values bridge, and leaves guard-only references in the private IR. Entry guards validate owner, protocol and bridge shape. Operator data uses, rest callbacks, escaping closures and continuations retain VM evaluation. Guard metadata stores no borrowed procedure environments or expected ephemeral bridge pointers. Original VM bytecode, native ABI, allocation policy and scalar/vector/byte transaction rollback remain unchanged.

The corrected baseline regression proves retained364 cannot create an enabled native plan for the outer call-with-values function. Checking only one native hit was inadequate because the consumer could enter independently; that initial observation is retained in recovery records. All 147 native cases passed freshly under ASan/UBSan and Boehm, including 18 new multiple-value cases. CLI checks cover both syntaxes and arity errors; default-build budget verification also passed. Tests include nesting, helpers, repeated internal definitions, early reads, aliasing, rebinding, hygienic references, closure-provider refresh after GC, continuations and overflow rollback of all three effect kinds.

All 1,800 comparison results passed on the same idle Intel i3 Mac mini: all 24 runtime and 12 mock-WM workloads, five configurations, ten fresh processes with nine retained samples. Configurations are retained364 and new365 with arena/Boehm, plus Guile 3.0.10 with unchanged guild-O2 wrappers and default JIT. One locked serial job used hash-verified snapshots, separately from builds and tests. All 144 cold-cache observations are separate; all 1,440 native comparison processes compiled zero sources during warmup and measurement. All fixtures, oracles and losses remain included. First-call and whole-process times remain available alongside prepared medians.

All 32 scaling groups passed 4 versus 400 calls with three repetitions per count, total-time ratios at least 20 and zero native compilations, including the values workload. Completed samples were journaled and resumed in the same snapshot and cache context.

Suite GC gain vs364 Arena gain vs364 Guile/new GC Guile/new arena
wm 0.997× 0.995× 0.436× 0.415×
numeric 1.284× 1.281× 0.934× 0.941×
all36 1.180× 1.177× 0.725× 0.716×

Guile/Vile ratios above one favor Vile. The all36 row gives every unchanged workload equal weight; both suite aggregates are also reported separately. The requested full 1.5× advantage remains unproven; the final 31-sample and full-objective gates are outstanding.

Regressions over 5% against364: numeric/bytevector-fill-4k (gc, 1.161× elapsed); numeric/bytevector-fill-4k (arena, 1.164× elapsed). All losses remain in the tables and aggregates.

wm

Workload 364 GC ms 365 GC ms Guile ms GC gain Arena gain
wm-callback-chain 0.567875 0.579452 0.641000 0.980× 1.000×
wm-event-dispatch 0.944256 0.938536 0.219500 1.006× 0.996×
wm-focus-cycle 0.600083 0.601944 0.378250 0.997× 1.000×
wm-tiling-layout 0.308412 0.309601 0.109000 0.996× 1.002×
wm-workspace-move 1.152646 1.151381 0.173750 1.001× 0.994×
wm-keybindings 4.566455 4.544420 0.280000 1.005× 1.002×
wm-hooks 2.367319 2.392584 0.354500 0.989× 1.012×
wm-lifecycle 1.082543 1.088937 0.129000 0.994× 1.001×
wm-macro-config 4.486600 4.492476 5.255250 0.999× 1.003×
wm-config-load-tree 5.020399 5.031579 8.988750 0.998× 0.985×
wm-reload-live 5.122770 5.142954 8.087500 0.996× 0.964×
wm-session-replay 5.328529 5.307328 8.065500 1.004× 0.987×

numeric

Workload 364 GC ms 365 GC ms Guile ms GC gain Arena gain
tail-sum-10k 0.005607 0.005606 0.033710 1.000× 1.000×
fib-20 0.146847 0.146800 0.310780 1.000× 0.999×
closure-5k 0.002129 0.002133 0.015530 0.998× 1.000×
list-3k 0.007291 0.007294 0.060080 1.000× 0.999×
flonum-sum-2k 0.002375 0.002382 0.095500 0.997× 0.999×
bignum-fib-200 0.061470 0.061582 0.005417 0.998× 1.000×
rational-harmonic-80 0.104663 0.104116 0.051000 1.005× 0.995×
integer-divmod-5k 0.007923 0.007919 0.167667 1.000× 1.000×
list-map-1k 0.131610 0.132795 0.048333 0.991× 0.985×
list-reverse-2k 0.068089 0.068180 0.060750 0.999× 1.010×
vector-update-2k 0.072758 0.073129 0.016167 0.995× 0.994×
bytevector-fill-4k 0.073867 0.085776 0.086167 0.861× 0.859×
hashtable-count-1k 0.488598 0.488205 5.959500 1.001× 0.994×
string-build-1k 0.048995 0.048993 0.042417 1.000× 1.001×
string-scan-4k 1.042629 1.039251 0.043750 1.003× 0.990×
unicode-scan-1k 0.275321 0.274804 0.011667 1.002× 0.994×
datum-read-write-200 1.561499 1.548338 2.253125 1.009× 1.005×
closure-mutate-2k 0.003016 0.003015 0.008417 1.000× 1.003×
higher-order-2k 0.004074 0.004079 0.006417 0.999× 1.000×
callcc-escape-1k 0.126793 0.126704 0.006667 1.001× 1.006×
values-consumer-1k 0.715139 0.001546 0.004417 462.449× 452.254×
dynamic-wind-200 0.160953 0.159289 0.012583 1.010× 0.999×
goops-dispatch-1k 0.780577 0.779022 0.110375 1.002× 1.007×
goops-allocate-200 0.113552 0.113377 0.054500 1.002× 0.996×

Build: vile-resume.iqs40ygm. Verification: vile-resume._kdtttqe. Measurement: vile-resume.2ahvv_kf. Recovery: validation/values365-initial-trial/.

This candidate is not retained yet. A separate nine-sample 400-call bytevector diagnostic confirms the roughly 16% slowdown with both collectors. Three-second profiles and disassembly are archived separately from comparison timings. Both binaries execute identical instruction sequences in the bytevector callback (157 lines), journal helper (71 lines) and generated library (903 instructions), at changed host addresses. The cause remains uncertain. The next experiment will remove the extra binding field and try inlining the existing journal helper; no alignment padding or fixture changes are proposed.