vile / bench / native / GUARDS-358.md
70 lines · 56 sloc · 6.26 KB · 76646891b77a3d5c6af4a1e42b122cd61dc1654b
Raw

Native vectors with cached binding guards (358)

Retained combined change: vector loops accelerate while the pure numeric kernels recover from candidate357’s regressions. Invariant global checks are cached within a native host scope; live arguments, captured values and global scalar values are still read on each entry.

Global replacement and primitive-generic installation/reset advance a scope-local revision. The cache also checks the existing binding-topology and syntax-declaration generations. Revision wrap invalidates all plans, and saturated syntax generations never use the cache. No VM fields, operation-time allocation or new GC dependency were added. Vector callback code and the larger C context are emitted only for vector graphs, preserving the compact pure integer/mixed-numeric runtime.

All 54 cases passed under AddressSanitizer/UndefinedBehaviorSanitizer and 54 under Boehm. New tests cover reuse across 100 calls with changing arguments, rebindings within one evaluation, live captured cells, primitive-generic resets, revision wrap and exhausted syntax generations. The normal build passed its budget test; CLI 2 passed, including rebinding after native execution. Existing vector rollback/GC/cache/control coverage remains included.

One locked job on the same idle Intel i3 Mac mini, from hash-verified sources. All 2,520 comparison samples passed: 36 workloads × 7 configurations × 10 fresh processes, nine retained. Configurations are retained356, candidate357 and new358, each with arena/Boehm, plus Guile 3.0.10. Separate native cache roots are populated per version/collector; all 2,160 native comparison processes compiled zero sources. The 216 population observations are separate. Prepared medians exclude setup/first use; raw first-call and whole-process times remain available. Guile uses the existing guild-O2 wrappers and default JIT. Every workload and four-seed oracle remains unchanged.

All 18 fresh scaling groups passed 4 versus 400 calls, three repetitions per count, with total-time ratios above 20. Samples are appended to a recovery journal; completed workload checkpoints resume without repeating successful groups.

Suite GC gain vs retained356 Arena gain vs retained356 GC gain vs357 Arena gain vs357 Guile/new GC Guile/new arena
wm 1.057× 1.008× 1.036× 1.036× 0.177× 0.164×
numeric 1.118× 1.081× 1.058× 1.060× 0.395× 0.390×

Ratios above one favor Vile. Guile still leads both complete suites; the requested 1.5× advantage is not achieved.

Regressions over 5% against retained356: bytevector-fill-4k (arena: 6.2% slower), callcc-escape-1k (arena: 7.7% slower). These remain in the tables and aggregate results.

wm

Workload Retained356 GC ms Vector357 GC ms New358 GC ms Guile ms GC gain vs356 Arena gain vs356
wm-callback-chain 7.349 7.259 6.790 0.638 1.082× 0.992×
wm-event-dispatch 5.303 5.364 5.192 0.218 1.021× 0.961×
wm-focus-cycle 6.084 5.872 5.641 0.378 1.079× 1.006×
wm-tiling-layout 3.512 3.370 3.244 0.115 1.083× 1.001×
wm-workspace-move 1.868 1.699 1.575 0.173 1.186× 1.089×
wm-keybindings 4.729 4.883 4.807 0.284 0.984× 1.014×
wm-hooks 3.912 3.710 3.454 0.359 1.133× 1.066×
wm-lifecycle 1.416 1.364 1.299 0.127 1.090× 1.008×
wm-macro-config 4.704 4.698 4.638 5.253 1.014× 1.010×
wm-config-load-tree 5.241 5.198 5.210 8.961 1.006× 1.006×
wm-reload-live 9.660 9.628 9.567 8.169 1.010× 0.971×
wm-session-replay 8.922 8.969 8.768 8.044 1.017× 0.985×

numeric

Workload Retained356 GC ms Vector357 GC ms New358 GC ms Guile ms GC gain vs356 Arena gain vs356
tail-sum-10k 0.006 0.006 0.006 0.034 1.002× 1.004×
fib-20 0.170 0.147 0.171 0.311 0.999× 1.000×
closure-5k 0.004 0.004 0.004 0.016 1.002× 1.001×
list-3k 0.008 0.008 0.007 0.060 1.079× 1.113×
flonum-sum-2k 0.012 0.015 0.012 0.096 1.012× 1.006×
bignum-fib-200 0.063 0.062 0.062 0.005 1.015× 0.988×
rational-harmonic-80 0.098 0.097 0.097 0.050 1.005× 0.996×
integer-divmod-5k 0.018 0.036 0.018 0.168 1.007× 1.005×
list-map-1k 0.147 0.155 0.125 0.049 1.174× 1.175×
list-reverse-2k 0.690 0.677 0.672 0.061 1.028× 1.003×
vector-update-2k 0.524 0.075 0.075 0.016 6.973× 6.542×
bytevector-fill-4k 1.080 1.023 1.023 0.086 1.056× 0.941×
hashtable-count-1k 0.502 0.482 0.482 5.969 1.041× 0.972×
string-build-1k 0.052 0.050 0.049 0.043 1.044× 0.979×
string-scan-4k 1.063 1.042 1.025 0.044 1.037× 0.990×
unicode-scan-1k 0.280 0.275 0.273 0.012 1.025× 0.983×
datum-read-write-200 1.578 1.567 1.571 2.263 1.005× 0.999×
closure-mutate-2k 0.465 0.442 0.443 0.008 1.050× 0.959×
higher-order-2k 0.021 0.026 0.021 0.006 1.007× 1.003×
callcc-escape-1k 0.133 0.127 0.126 0.007 1.057× 0.929×
values-consumer-1k 0.748 0.743 0.715 0.004 1.046× 1.020×
dynamic-wind-200 0.164 0.161 0.159 0.013 1.033× 0.982×
goops-dispatch-1k 0.800 0.782 0.786 0.110 1.018× 0.983×
goops-allocate-200 0.115 0.113 0.114 0.055 1.014× 0.997×

Separate post-benchmark profiles passed their checksums. WM callback time remains largely in interpreter dispatch, activation and native-entry bookkeeping; compiled vector execution is a small part of that profile. The vector-update kernel instead spends most of its time in native vector callbacks. Next work should reduce repeated VM/native transitions for callback loops before optimizing individual vector accesses. Profiles are diagnostic, not additional timing comparisons.

Build snapshot: vile-resume.ddohrgqj. Measurement snapshot: vile-resume.fqn00hod. Profile snapshot: vile-resume.9rzdd1p5. Archive: validation/guards358/ in the recovery directory. The final 31-sample gate and full objective remain outstanding.