vile / bench / native / BYTES-364.md
70 lines · 56 sloc · 6.19 KB · 76646891b77a3d5c6af4a1e42b122cd61dc1654b
Raw

Native borrowed bytevectors (364)

Native graphs can read bytevector length and unsigned bytes, and update existing bytevectors through the existing host callback. Readonly flags, argument counts, exact integer indexes, bounds and byte ranges remain checked. Borrowed handles retain their original identity and readonly flags when returned or stored in vectors. Nested vector reads and changing globals/captures refresh live handles.

Byte and vector writes share the existing bounded first-touch journal: 1,024 changed cells and the same 2,048 reusable epoch buckets. Negative journal indexes identify byte cells; ordinary vector indexes remain unchanged. Original owner handles remain on the C stack through commit or rollback and are cleared afterward. Overflow, unsupported stores and exhaustion restore both sequence kinds and discard staged scalar captures before VM replay. There is no per-byte allocation, new GC dependency or larger fixed journal. Raw byte indexing preserves full host offsets; generated C never assumes the VM bytevector layout.

The host-only pair-import marker moved outside the new bytevector handle range. Existing pair imports and vector reads of pair values retain their previous behavior. Byte-only graphs keep integer specialization; ordinary vector graphs retain mixed arithmetic. Native function signatures and value layouts remain unchanged, and the optional backend introduces no VM operation or language change.

The original bytevector regression fails retained363 and passes in one native entry. All 129 native tests passed freshly under ASan/UBSan and Boehm, alongside both production builds, CLI tests and the default-build budget check. New cases cover repeated writes, 1,024/1,025-cell limits, mixed byte/vector capacity and rollback, scalar capture speculation, owner collection, readonly values, wrong types/ranges, primitive rebinding, nested handles, publication, Vile syntax and instruction budgets. A virtual mapping verifies reads, writes and rollback above 2 GiB while touching only a few pages.

All 1,800 comparison results passed on the same idle Intel i3 Mac mini: 36 unchanged workloads × five configurations × ten fresh processes, nine retained. Configurations are retained363 and new364 with arena/Boehm, plus Guile 3.0.10 with unchanged guild-O2 wrappers and default JIT. One locked serial job ran from hash-verified snapshots, separately from builds/tests. All 144 cache-population observations are separate; all 1,440 native comparison processes compiled zero sources. Prepared medians exclude setup and first use; raw first-call and whole-process times remain available. All cases, oracles and losses are included.

All 30 scaling groups passed 4 versus 400 calls, three repetitions per count, requiring total-time ratios above 20 and zero native compilations. Completed samples are journaled in the same source/cache context.

Suite GC gain vs363 Arena gain vs363 Guile/new GC Guile/new arena
wm 1.001× 1.002× 0.439× 0.419×
numeric 1.126× 1.118× 0.728× 0.736×

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

Regressions over 5% against363: none. All losses remain in the tables and aggregates.

wm

Workload 363 GC ms 364 GC ms Guile ms GC gain Arena gain
wm-callback-chain 0.568285 0.560481 0.642000 1.014× 1.014×
wm-event-dispatch 0.941875 0.948725 0.218750 0.993× 0.997×
wm-focus-cycle 0.594377 0.599817 0.377000 0.991× 1.013×
wm-tiling-layout 0.312125 0.309185 0.114750 1.010× 1.010×
wm-workspace-move 1.147788 1.152054 0.174000 0.996× 0.999×
wm-keybindings 4.522164 4.538636 0.279500 0.996× 1.001×
wm-hooks 2.379598 2.368645 0.359000 1.005× 0.993×
wm-lifecycle 1.079206 1.081308 0.125750 0.998× 1.003×
wm-macro-config 4.476913 4.465788 5.261500 1.002× 0.996×
wm-config-load-tree 5.020280 5.006069 8.991750 1.003× 0.996×
wm-reload-live 5.117078 5.125739 8.097750 0.998× 1.016×
wm-session-replay 5.366029 5.317959 8.032000 1.009× 0.983×

numeric

Workload 363 GC ms 364 GC ms Guile ms GC gain Arena gain
tail-sum-10k 0.005607 0.005605 0.033720 1.000× 1.000×
fib-20 0.146842 0.146851 0.311600 1.000× 1.000×
closure-5k 0.002701 0.002132 0.015580 1.267× 1.000×
list-3k 0.007302 0.007284 0.060320 1.003× 0.999×
flonum-sum-2k 0.002372 0.002380 0.095833 0.997× 1.000×
bignum-fib-200 0.061513 0.061567 0.005417 0.999× 1.002×
rational-harmonic-80 0.105054 0.104634 0.051250 1.004× 1.002×
integer-divmod-5k 0.007919 0.007927 0.167917 0.999× 1.000×
list-map-1k 0.132871 0.131594 0.048417 1.010× 1.011×
list-reverse-2k 0.067996 0.068155 0.060917 0.998× 0.977×
vector-update-2k 0.073177 0.072813 0.016167 1.005× 0.990×
bytevector-fill-4k 1.026085 0.074015 0.086083 13.863× 14.443×
hashtable-count-1k 0.485480 0.489424 5.991083 0.992× 0.997×
string-build-1k 0.049063 0.049381 0.043250 0.994× 1.004×
string-scan-4k 1.032848 1.041016 0.043750 0.992× 1.012×
unicode-scan-1k 0.272766 0.275149 0.011750 0.991× 1.008×
datum-read-write-200 1.560232 1.560156 2.258500 1.000× 1.000×
closure-mutate-2k 0.003028 0.003020 0.008417 1.003× 0.995×
higher-order-2k 0.004078 0.004084 0.006333 0.998× 1.001×
callcc-escape-1k 0.126824 0.126999 0.006667 0.999× 1.001×
values-consumer-1k 0.737285 0.744879 0.004417 0.990× 1.000×
dynamic-wind-200 0.159782 0.160082 0.012500 0.998× 1.006×
goops-dispatch-1k 0.783381 0.780350 0.110375 1.004× 1.002×
goops-allocate-200 0.113744 0.113446 0.055125 1.003× 0.998×

Build: vile-resume.7vutnmfm. Verification: vile-resume.v7ss7056. Measurement: vile-resume.jxyoyis1. Recovery: validation/bytes364/.