vile / bench / runtime / FRAMES-387.md
122 lines · 103 sloc · 9.82 KB · 76646891b77a3d5c6af4a1e42b122cd61dc1654b
Raw

Typed append to cached closure frames (387)

Cached non-tail closure entry stores its return frame directly in the already available slot of the machine’s private frame buffer, then increments length. Existing capacity/frame/owner/arity/rest/star/GOOPS/native-priority/step guards and activation reuse are unchanged. Full application and frame growth keep their existing paths. Continuations clone frames, and loop/return snapshots copy them; restoration copies into private invocation buffers. No frame view is exposed.

A small nongeneric private helper follows the existing Machine.push pattern. All four actual production outputs inline it, remove one generic array-push call from Machine.run (five to four), and add no allocation/clone in the helper or cached entry. Remaining generic pushes include stack growth. The first direct-store formulation passed focused tests but its production build hit a V unsafe-context checker limitation; its exact source/diagnostics are separately preserved in frame387-compiler-trial. No compiler or standard-library source changed.

Four new regressions pass on the unchanged 384 baseline and candidate under both engine builds and ASan/UBSan/Boehm. They verify buffer identity, complete saved caller registers, independent snapshots, full-capacity/frame-limit rejection without mutation, tail entry with zero frame capacity, and multishot replay after capture followed by 128-frame growth. This performance-only change claims no functional baseline failure. Candidate qualification adds 33 nearby continuation/map/scope/tail/wind cases, giving 37 per engine/mode. The broader gate passes 354 ordinary and 230 native cases per mode, plus two CLI cases and the default-build budget check; every native label and ordinary group preserves its own raw log hash.

Both engines/collectors are compared separately with retained 384 and Guile 3.0.10 on the same idle Intel Mac mini. Each full suite retains 24 runtime and 12 mock-WM workloads, unchanged fixtures, four-input oracles, batches, five warmups and frozen guild-O2/default-JIT Guile wrappers. Ten fresh processes give nine retained samples after excluding sample zero. Both 1,800-row matrices pass every result check. Interpreted rows have all native/cache/compilation counters zero; optional-native preparation records 144 cold observations in a separate job and warmup/measured compilation remains zero.

All 46 native and 18 ordinary scaling groups pass 4 versus 400 calls, three repeats and at least 20x elapsed growth. Builds, tests, preparation and measurements run serially from hash-verified snapshots under the shared lock, with idle checks before timings. Prepared medians exclude setup/first use; repeated workload loading/macro work remains included. All workloads, losses, raw process/first-call data and caches remain available. R7RS first-use results remain separate.

Ratios above one favor the candidate or Vile, respectively. Aggregates are equal-weight geometric means. The full 1.5x goal remains unproven; final 31-sample/full-objective verification is outstanding.

Engine Suite GC gain vs384 Arena gain vs384 Guile/Vile GC Guile/Vile arena
interpreter wm 1.010x 1.010x 0.266x 0.262x
interpreter runtime 1.018x 1.013x 0.141x 0.138x
interpreter all36 1.016x 1.012x 0.174x 0.171x
native wm 1.011x 0.998x 0.642x 0.631x
native runtime 0.998x 1.002x 1.191x 1.215x
native all36 1.002x 1.001x 0.969x 0.976x

interpreter regressions above 5%: none. All losses remain included.

interpreter / wm

Workload 384 GC ms 387 GC ms Guile ms GC gain Arena gain
wm-callback-chain 4.652187 4.546501 0.641750 1.023x 1.011x
wm-event-dispatch 2.810034 2.777484 0.217250 1.012x 1.015x
wm-focus-cycle 4.121669 4.077680 0.378000 1.011x 1.007x
wm-tiling-layout 1.765950 1.750343 0.108500 1.009x 1.017x
wm-workspace-move 1.239951 1.208809 0.178000 1.026x 1.014x
wm-keybindings 1.135512 1.143033 0.284250 0.993x 1.001x
wm-hooks 2.813779 2.747005 0.356250 1.024x 1.014x
wm-lifecycle 0.989319 0.967206 0.126250 1.023x 1.016x
wm-macro-config 4.457661 4.439561 5.301250 1.004x 1.009x
wm-config-load-tree 4.960382 4.951424 8.983000 1.002x 0.995x
wm-reload-live 7.058152 7.075804 8.135500 0.998x 1.016x
wm-session-replay 6.437113 6.434367 8.075000 1.000x 1.004x

interpreter / runtime

Workload 384 GC ms 387 GC ms Guile ms GC gain Arena gain
tail-sum-10k 0.663650 0.663455 0.033650 1.000x 1.007x
fib-20 4.824745 4.439327 0.313230 1.087x 1.062x
closure-5k 0.534026 0.491840 0.015550 1.086x 1.054x
list-3k 0.892299 0.890248 0.059630 1.002x 1.011x
flonum-sum-2k 0.476753 0.486753 0.095500 0.979x 0.993x
bignum-fib-200 0.033146 0.033229 0.005500 0.997x 0.989x
rational-harmonic-80 0.095088 0.095992 0.049000 0.991x 1.008x
integer-divmod-5k 0.806466 0.818943 0.169083 0.985x 1.015x
list-map-1k 0.116813 0.110502 0.048917 1.057x 1.023x
list-reverse-2k 0.469006 0.464402 0.060833 1.010x 1.009x
vector-update-2k 0.377894 0.366735 0.016167 1.030x 1.003x
bytevector-fill-4k 0.750250 0.747185 0.086167 1.004x 1.012x
hashtable-count-1k 0.431669 0.431424 5.940083 1.001x 0.998x
string-build-1k 0.041706 0.041623 0.043000 1.002x 1.009x
string-scan-4k 0.638499 0.635728 0.043750 1.004x 1.002x
unicode-scan-1k 0.173120 0.170890 0.011750 1.013x 0.998x
datum-read-write-200 1.214151 1.214926 2.269000 0.999x 1.010x
closure-mutate-2k 0.289811 0.273269 0.008417 1.061x 1.052x
higher-order-2k 0.375748 0.349155 0.006333 1.076x 1.049x
callcc-escape-1k 0.069034 0.068756 0.006667 1.004x 0.993x
values-consumer-1k 0.603161 0.593500 0.004417 1.016x 1.010x
dynamic-wind-200 0.131202 0.127265 0.012583 1.031x 1.010x
goops-dispatch-1k 0.752597 0.742342 0.110375 1.014x 1.000x
goops-allocate-200 0.081557 0.081267 0.054625 1.004x 1.011x

native regressions above 5%: runtime/closure-5k (arena, 1.163x elapsed). All losses remain included.

The primary arena closure result showed two timing clusters in both builds. A separate balanced repeat retained 31 samples per configuration (128 observations including excluded sample zero), with the same 100-call batch, five warmups, measurement cwd and prepared caches. It did not reproduce the loss: arena 2158.34 to 2157.75ns/call; GC 2131.52 to 2129.80ns/call. All oracles/counters pass and no compilation occurs. This diagnostic remains separate: the original closure loss and full-suite aggregates above are unchanged.

native / wm

Workload 384 GC ms 387 GC ms Guile ms GC gain Arena gain
wm-callback-chain 0.487145 0.476602 0.638250 1.022x 0.988x
wm-event-dispatch 0.837640 0.819804 0.219000 1.022x 0.994x
wm-focus-cycle 0.486274 0.478149 0.380750 1.017x 0.985x
wm-tiling-layout 0.271008 0.258866 0.110250 1.047x 0.978x
wm-workspace-move 0.193195 0.189056 0.178000 1.022x 0.983x
wm-keybindings 0.967883 0.976318 0.279750 0.991x 1.020x
wm-hooks 2.297458 2.291421 0.358750 1.003x 1.003x
wm-lifecycle 0.879182 0.877166 0.130750 1.002x 1.026x
wm-macro-config 4.423945 4.410710 5.268750 1.003x 1.004x
wm-config-load-tree 4.672462 4.668704 8.980500 1.001x 0.983x
wm-reload-live 4.852449 4.850465 8.182250 1.000x 1.001x
wm-session-replay 4.888899 4.900924 8.099750 0.998x 1.012x

native / runtime

Workload 384 GC ms 387 GC ms Guile ms GC gain Arena gain
tail-sum-10k 0.005605 0.005606 0.033720 1.000x 1.000x
fib-20 0.146906 0.146993 0.311020 0.999x 0.999x
closure-5k 0.002130 0.002129 0.015580 1.000x 0.860x
list-3k 0.007214 0.007226 0.060170 0.998x 1.000x
flonum-sum-2k 0.002374 0.002377 0.095917 0.998x 0.999x
bignum-fib-200 0.043227 0.042999 0.005500 1.005x 1.005x
rational-harmonic-80 0.104096 0.103679 0.050375 1.004x 1.008x
integer-divmod-5k 0.007922 0.007928 0.168250 0.999x 1.000x
list-map-1k 0.130229 0.130992 0.048667 0.994x 0.989x
list-reverse-2k 0.067428 0.068861 0.060667 0.979x 0.990x
vector-update-2k 0.062648 0.060393 0.016250 1.037x 0.984x
bytevector-fill-4k 0.079465 0.083411 0.086167 0.953x 1.061x
hashtable-count-1k 0.459800 0.459226 5.943917 1.001x 1.006x
string-build-1k 0.044883 0.045240 0.042833 0.992x 1.001x
string-scan-4k 0.094909 0.094173 0.043750 1.008x 1.039x
unicode-scan-1k 0.035611 0.036688 0.011750 0.971x 1.008x
datum-read-write-200 1.584392 1.599929 2.265375 0.990x 1.006x
closure-mutate-2k 0.002945 0.002900 0.008417 1.015x 1.000x
higher-order-2k 0.004075 0.004078 0.006333 0.999x 1.000x
callcc-escape-1k 0.094954 0.094798 0.006667 1.002x 1.031x
values-consumer-1k 0.001553 0.001554 0.004417 0.999x 1.002x
dynamic-wind-200 0.149323 0.149090 0.012667 1.002x 1.009x
goops-dispatch-1k 0.784137 0.782995 0.110375 1.001x 1.064x
goops-allocate-200 0.086326 0.085991 0.054750 1.004x 1.002x

Build: vile-resume.klwkt2yn. Verification: vile-resume.t9gdvsql. Ordinary measurement: vile-resume.p62irlbm. Native measurement: vile-resume.p62irlbm. Recovery: validation/frame387/.