vile / bench / native / BINDINGS-360.md
70 lines · 56 sloc · 6.85 KB · 76646891b77a3d5c6af4a1e42b122cd61dc1654b
Raw

Native existing-closure providers and immediate binding helpers (359–360)

Existing closure arguments and captured callbacks can participate in native graphs. Each entry checks their live owner, code and capture identities; same-code closures retain independent environments. Guarded captured function loads use constant code IDs. Native inexact->exact rejects non-numbers in both numeric paths, including before a branch or callback call.

Immediate binding helpers are lowered into private native IR after a control-flow proof rejects escaping helper values and ambiguous identities. Arguments keep source evaluation order, nested lexical locations map to private locals or existing captures, and internal definitions reset to uninitialized on every helper entry. Tail calls through let retain the enclosing tail context. The original VM bytecode stays intact for fallback and replay. Metadata uses explicit arenas; no new GC dependency or per-operation closure/environment allocation was added.

All 71 cases passed under AddressSanitizer/UndefinedBehaviorSanitizer and 71 under Boehm, with the normal-build budget test and both CLI test functions. New coverage includes binding order, nested/non-tail helpers, lexical writes, escaped locations, continuation reentry, replay, hygienic private global references and both frontends. The actual WM callback regression runs 4,096 callbacks in one native entry without deoptimization, comparing the complete state to the interpreter.

One locked serial job on the same idle Intel i3 Mac mini, using hash-verified snapshots. All 2,520 comparison results passed: 36 workloads × 7 configurations × 10 fresh processes, nine retained. Configurations are retained358, providers359 and bindings360, each with arena/Boehm, plus Guile 3.0.10. The 216 native cache-population observations are separate; all 2,160 native comparison processes compiled zero sources. Setup and first use are excluded from prepared medians; raw first-call and whole-process times remain available. Guile uses the unchanged guild-O2 wrappers and default JIT. Every workload and four-seed oracle is retained.

All 20 scaling groups passed 4 versus 400 calls, three repetitions per count, requiring total-time ratios above 20. The recovery journal and workload checkpoints preserve completed samples. macOS Software Update interrupted the earlier standalone359 idle gate before any timings; that incomplete run is archived separately and is not mixed into these medians. Copying its cache entries initially failed to preserve reuse because keys include cwd and cache path. Those 12 groups were repopulated in this snapshot. One process that compiled during warmup was excluded, while all 70 valid completed samples were preserved. The original and corrected population observations and recovery details are archived.

Suite 359 GC gain vs358 360 GC gain vs358 360 arena gain vs358 360 GC gain vs359 Guile/360 GC Guile/360 arena
wm 0.995× 1.876× 1.911× 1.886× 0.332× 0.313×
numeric 1.139× 1.140× 1.146× 1.001× 0.452× 0.448×

Guile/Vile ratios above one favor Vile. The full requested 1.5× advantage remains unproven; the final 31-sample and full-objective gates are outstanding.

Regressions over 5%: none against either baseline. All losses remain in the tables and aggregates.

wm

Workload 358 GC ms 359 GC ms 360 GC ms Guile ms 360 GC gain vs358 360 arena gain vs358
wm-callback-chain 6.773 6.879 0.605 0.637 11.187× 11.419×
wm-event-dispatch 5.193 5.200 1.408 0.215 3.689× 3.871×
wm-focus-cycle 5.602 5.620 3.447 0.380 1.625× 1.690×
wm-tiling-layout 3.238 3.276 0.570 0.110 5.684× 5.801×
wm-workspace-move 1.566 1.586 1.218 0.178 1.287× 1.303×
wm-keybindings 4.808 4.816 4.437 0.280 1.084× 1.049×
wm-hooks 3.456 3.464 2.657 0.359 1.301× 1.339×
wm-lifecycle 1.290 1.300 1.262 0.126 1.023× 1.027×
wm-macro-config 4.656 4.644 4.532 5.288 1.027× 1.028×
wm-config-load-tree 5.204 5.183 5.117 9.171 1.017× 1.031×
wm-reload-live 9.459 9.538 5.635 8.130 1.679× 1.748×
wm-session-replay 8.763 8.815 5.702 8.058 1.537× 1.571×

numeric

Workload 358 GC ms 359 GC ms 360 GC ms Guile ms 360 GC gain vs358 360 arena gain vs358
tail-sum-10k 0.006 0.006 0.006 0.034 0.999× 0.999×
fib-20 0.173 0.170 0.172 0.311 1.004× 1.000×
closure-5k 0.004 0.003 0.003 0.016 1.493× 1.494×
list-3k 0.007 0.007 0.007 0.060 0.998× 0.996×
flonum-sum-2k 0.012 0.006 0.006 0.097 2.101× 2.145×
bignum-fib-200 0.062 0.062 0.062 0.005 0.996× 0.998×
rational-harmonic-80 0.098 0.098 0.098 0.052 1.007× 1.008×
integer-divmod-5k 0.018 0.012 0.012 0.169 1.456× 1.467×
list-map-1k 0.125 0.131 0.130 0.048 0.964× 0.967×
list-reverse-2k 0.666 0.670 0.672 0.061 0.991× 1.000×
vector-update-2k 0.075 0.071 0.071 0.016 1.056× 1.026×
bytevector-fill-4k 1.019 1.030 1.024 0.086 0.995× 0.995×
hashtable-count-1k 0.484 0.485 0.490 5.934 0.987× 0.992×
string-build-1k 0.049 0.049 0.049 0.043 1.003× 1.002×
string-scan-4k 1.024 1.039 1.019 0.044 1.005× 1.010×
unicode-scan-1k 0.273 0.275 0.269 0.012 1.015× 1.015×
datum-read-write-200 1.556 1.588 1.595 2.284 0.975× 1.008×
closure-mutate-2k 0.443 0.448 0.448 0.008 0.990× 0.990×
higher-order-2k 0.021 0.004 0.004 0.006 5.390× 5.628×
callcc-escape-1k 0.125 0.127 0.127 0.007 0.990× 0.992×
values-consumer-1k 0.714 0.726 0.725 0.004 0.985× 0.990×
dynamic-wind-200 0.159 0.160 0.161 0.013 0.988× 1.001×
goops-dispatch-1k 0.788 0.790 0.788 0.110 0.999× 1.011×
goops-allocate-200 0.114 0.113 0.113 0.055 1.006× 1.000×

Build snapshot: vile-resume.bsciaug9. Verification snapshot: vile-resume.iibnqcat. Measurement snapshot: vile-resume.wyqph232. Recovery archive: validation/bindings360/.

Seven separate diagnostic profiles passed their checksums after timing completed. Callback-chain time now lies mostly in native arithmetic/vector operations. WM focus still spends substantial time in VM dispatch and native entry. Bytevector, borrowed-list, multiple-values and captured-counter workloads remain largely in the VM; these are the next optimization targets. Captured scalar mutation is the next concrete step, with alias checks and staged commit/rollback required. Profiles are diagnostic and are not additional speed comparisons.