vile / bench / native / VALUES-365.md
73 lines · 58 sloc · 7.51 KB · 76646891b77a3d5c6af4a1e42b122cd61dc1654b
Raw

Private multiple-value callbacks (365)

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.

The refined nine-sample comparison retains a roughly 25% arena closure-workload median loss. Its before/after samples overlap two timing groups around 2.15 and 2.7 microseconds, with identical native hit/deopt counts; this does not establish the cause. The reported loss stays in the table and aggregates. A separate 31-sample closure diagnostic gives nearly equal medians: GC 2.12871 versus 2.12815 microseconds, arena 2.16019 versus 2.15624 microseconds. These supplementary observations remain separate and do not replace any original comparison rows.

The initial trial improved the values workload but regressed bytevector fill about 16% with both collectors. A separate nine-sample 400-call diagnostic confirmed that loss. The refined candidate reuses the existing binding target field instead of adding per-binding storage, and marks the shared journal helper inline. The current compiler still emits the helper call, so no inlining gain is claimed. Before/after callback, journal and generated-library instruction sequences in the initial diagnostic were identical at changed host addresses; the cause of the timing difference remains uncertain. All initial losses, longer-batch probes and separate profiles remain archived.

Suite GC gain vs364 Arena gain vs364 Guile/new GC Guile/new arena
wm 1.002× 1.000× 0.438× 0.417×
numeric 1.294× 1.276× 0.941× 0.938×
all36 1.188× 1.177× 0.730× 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/closure-5k (arena, 1.251× 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.567645 0.566739 0.637500 1.002× 0.999×
wm-event-dispatch 0.942129 0.938542 0.219000 1.004× 1.002×
wm-focus-cycle 0.600227 0.600636 0.377750 0.999× 0.997×
wm-tiling-layout 0.307863 0.309323 0.110000 0.995× 1.001×
wm-workspace-move 1.152666 1.155514 0.177750 0.998× 1.002×
wm-keybindings 4.534793 4.537394 0.279500 0.999× 1.002×
wm-hooks 2.362742 2.372945 0.354500 0.996× 0.998×
wm-lifecycle 1.085755 1.082313 0.129000 1.003× 1.003×
wm-macro-config 4.502177 4.497365 5.254000 1.001× 0.995×
wm-config-load-tree 5.071030 5.005126 8.977750 1.013× 0.997×
wm-reload-live 5.143590 5.107402 8.116250 1.007× 1.015×
wm-session-replay 5.318065 5.308560 8.065500 1.002× 0.993×

numeric

Workload 364 GC ms 365 GC ms Guile ms GC gain Arena gain
tail-sum-10k 0.005607 0.005605 0.033700 1.000× 1.000×
fib-20 0.147046 0.146834 0.311000 1.001× 0.995×
closure-5k 0.002128 0.002127 0.015560 1.000× 0.800×
list-3k 0.007299 0.007289 0.059700 1.001× 0.999×
flonum-sum-2k 0.002375 0.002386 0.096000 0.995× 1.000×
bignum-fib-200 0.061511 0.061563 0.005417 0.999× 0.999×
rational-harmonic-80 0.104949 0.104777 0.051125 1.002× 1.004×
integer-divmod-5k 0.007920 0.007910 0.168250 1.001× 1.000×
list-map-1k 0.131595 0.131429 0.048417 1.001× 1.001×
list-reverse-2k 0.068076 0.067264 0.060583 1.012× 0.983×
vector-update-2k 0.072801 0.072818 0.016167 1.000× 0.998×
bytevector-fill-4k 0.073952 0.073989 0.086083 0.999× 0.985×
hashtable-count-1k 0.490534 0.483651 5.974667 1.014× 0.995×
string-build-1k 0.049219 0.048931 0.042667 1.006× 0.999×
string-scan-4k 1.040628 1.033488 0.043750 1.007× 0.982×
unicode-scan-1k 0.275483 0.273839 0.011750 1.006× 0.992×
datum-read-write-200 1.555388 1.569609 2.254875 0.991× 1.013×
closure-mutate-2k 0.003019 0.003021 0.008500 1.000× 1.001×
higher-order-2k 0.004078 0.004077 0.006333 1.000× 1.000×
callcc-escape-1k 0.126666 0.126914 0.006583 0.998× 1.005×
values-consumer-1k 0.732670 0.001548 0.004417 473.403× 451.645×
dynamic-wind-200 0.160549 0.161669 0.012750 0.993× 1.002×
goops-dispatch-1k 0.782893 0.784674 0.110500 0.998× 1.004×
goops-allocate-200 0.113688 0.113374 0.054750 1.003× 1.001×

Build: vile-resume.p7aatvbm. Verification: vile-resume.s4juqx_c. Measurement: vile-resume.k_ghk_qn. Recovery: validation/values365/.