vile / bench / runtime / INTEGER-382.md
123 lines · 105 sloc · 8.89 KB · 76646891b77a3d5c6af4a1e42b122cd61dc1654b
Raw

Exact-integer arithmetic without rational reduction (382)

Addition, subtraction and multiplication of two exact integers now use existing math.big operations and owned_big_integer directly, before decomposition into numerator/denominator pairs. The eight-line production change borrows immutable operand headers and retains canonical promotion/demotion. Actual generated C for all four binaries shows header borrowing followed by the existing arithmetic and result-boxing calls. Existing zero/unit identities, division, fractions, real and complex paths remain in place. No private limb access, new runtime API, result copy or GC dependency is added.

The retained baseline passes the four new regressions: 555 independently generated Python integer oracles check signed results, input immutability and canonical kinds; other cases cover results after freeing operand arenas, fraction/division/complex/type boundaries and the Vile frontend. All 13 focused numeric/ownership cases pass under ASan/UBSan and Boehm. The broader gate passes all 314 ordinary numeric/control/ownership cases and 165 native/fallback cases per mode, plus two CLI cases and the default-build budget check.

Interpreted Vile is compared against retained375; native-enabled Vile against retained378. Each comparison uses the same 24 runtime and 12 mock-WM workloads on the idle Intel Mac mini, both collectors and Guile 3.0.10 with frozen guild-O2 wrappers/default JIT. All four-input oracles, input sizes, batch counts and five warmups remain unchanged. Each dataset has 1800 fresh-process observations; sample zero is excluded and nine samples retained. All observations pass. All interpreter native counters are zero. Separate native cache preparation populated 144 cold observations; warmups and measured intervals compiled zero sources.

All 14 interpreter and 40 native scaling groups pass 4 versus 400 calls with three repeats and at least 20x elapsed-time growth. New scaling coverage includes bignum Fibonacci and rational harmonics while retaining earlier groups. Builds, tests, cache preparation and timing jobs ran serially from hash-verified snapshots. Prepared medians exclude setup and first use; repeated loading and macro work inside workloads remain included. Every workload and loss, raw first-call/process time and cache library is retained. The separately imported R7RS first-use suite is not combined with these prepared timings.

Guile/Vile ratios above one favor Vile. Aggregates are equal-weight geometric means over all36 workloads. The full 1.5x goal remains unproven; final 31-sample/full-objective verification is outstanding.

interpreter

Suite GC gain Arena gain Guile/Vile GC Guile/Vile arena
wm 1.002x 1.000x 0.259x 0.257x
runtime 1.016x 1.015x 0.139x 0.136x
all36 1.012x 1.010x 0.171x 0.168x

Regressions above 5%: none. All losses remain included.

wm

Workload Before GC ms After GC ms Guile ms GC gain Arena gain
wm-callback-chain 4.654022 4.642214 0.638500 1.003x 1.001x
wm-event-dispatch 2.829407 2.827479 0.214750 1.001x 1.001x
wm-focus-cycle 4.140280 4.131600 0.377750 1.002x 1.007x
wm-tiling-layout 1.777486 1.781552 0.109250 0.998x 1.003x
wm-workspace-move 1.248606 1.246266 0.173000 1.002x 0.998x
wm-keybindings 1.140211 1.137721 0.278500 1.002x 1.004x
wm-hooks 2.825372 2.811775 0.359750 1.005x 0.996x
wm-lifecycle 0.996701 0.993890 0.119250 1.003x 1.000x
wm-macro-config 4.452117 4.445263 5.181000 1.002x 0.993x
wm-config-load-tree 4.987571 4.984482 8.972000 1.001x 0.996x
wm-reload-live 7.133685 7.087767 8.171250 1.006x 1.005x
wm-session-replay 6.463870 6.453610 8.089500 1.002x 0.998x
### runtime
Workload Before GC ms After GC ms Guile ms GC gain Arena gain
tail-sum-10k 0.664695 0.664693 0.033700 1.000x 0.991x
fib-20 4.781134 4.784306 0.310650 0.999x 0.999x
closure-5k 0.525122 0.527126 0.015520 0.996x 0.994x
list-3k 0.891945 0.889545 0.060170 1.003x 1.000x
flonum-sum-2k 0.493726 0.477873 0.096000 1.033x 1.016x
bignum-fib-200 0.047128 0.033166 0.005417 1.421x 1.386x
rational-harmonic-80 0.094798 0.094549 0.051500 1.003x 1.004x
integer-divmod-5k 0.823453 0.809912 0.168250 1.017x 0.996x
list-map-1k 0.117878 0.118696 0.048583 0.993x 0.994x
list-reverse-2k 0.469458 0.465317 0.061083 1.009x 1.001x
vector-update-2k 0.377628 0.376386 0.016167 1.003x 1.006x
bytevector-fill-4k 0.741705 0.746305 0.086167 0.994x 0.999x
hashtable-count-1k 0.433040 0.428745 5.998667 1.010x 1.005x
string-build-1k 0.041544 0.041655 0.044250 0.997x 1.014x
string-scan-4k 0.643619 0.641607 0.043750 1.003x 1.005x
unicode-scan-1k 0.173087 0.173549 0.011750 0.997x 1.012x
datum-read-write-200 1.188455 1.213581 2.287750 0.979x 1.007x
closure-mutate-2k 0.288218 0.286776 0.008417 1.005x 1.005x
higher-order-2k 0.369861 0.371050 0.006333 0.997x 1.003x
callcc-escape-1k 0.068419 0.068279 0.006667 1.002x 0.997x
values-consumer-1k 0.596615 0.599168 0.004417 0.996x 0.993x
dynamic-wind-200 0.140886 0.140420 0.012500 1.003x 0.989x
goops-dispatch-1k 0.749140 0.748569 0.108375 1.001x 0.996x
goops-allocate-200 0.081343 0.081229 0.054875 1.001x 0.999x

native

Suite GC gain Arena gain Guile/Vile GC Guile/Vile arena
wm 1.002x 0.997x 0.634x 0.630x
runtime 1.011x 1.011x 1.182x 1.212x
all36 1.008x 1.006x 0.961x 0.974x

Regressions above 5%: [{"suite": "runtime", "name": "closure-5k", "mode": "arena", "elapsed_ratio": 1.0684018336510985}]. All losses remain included.

wm

Workload Before GC ms After GC ms Guile ms GC gain Arena gain
wm-callback-chain 0.485847 0.487275 0.637750 0.997x 1.004x
wm-event-dispatch 0.834326 0.834359 0.216250 1.000x 0.997x
wm-focus-cycle 0.487183 0.483932 0.379750 1.007x 1.000x
wm-tiling-layout 0.269170 0.264561 0.110000 1.017x 1.005x
wm-workspace-move 0.193462 0.191174 0.173500 1.012x 1.002x
wm-keybindings 0.976718 0.971162 0.284250 1.006x 1.005x
wm-hooks 2.299007 2.309228 0.357000 0.996x 0.988x
wm-lifecycle 0.876188 0.881642 0.129750 0.994x 0.982x
wm-macro-config 4.434083 4.417770 5.330500 1.004x 1.009x
wm-config-load-tree 4.669584 4.690620 9.003000 0.996x 0.997x
wm-reload-live 4.853842 4.864033 8.129000 0.998x 0.996x
wm-session-replay 4.937608 4.914317 8.049750 1.005x 0.984x
### runtime
Workload Before GC ms After GC ms Guile ms GC gain Arena gain
tail-sum-10k 0.005608 0.005606 0.033700 1.000x 1.000x
fib-20 0.146862 0.147711 0.311080 0.994x 0.998x
closure-5k 0.002642 0.002746 0.015520 0.962x 0.936x
list-3k 0.007225 0.007212 0.060070 1.002x 0.998x
flonum-sum-2k 0.002371 0.002374 0.096500 0.999x 1.000x
bignum-fib-200 0.056581 0.042521 0.005417 1.331x 1.338x
rational-harmonic-80 0.104295 0.103050 0.049375 1.012x 0.993x
integer-divmod-5k 0.007914 0.007925 0.168083 0.999x 1.000x
list-map-1k 0.134607 0.133904 0.048667 1.005x 0.987x
list-reverse-2k 0.066868 0.066968 0.060667 0.999x 1.009x
vector-update-2k 0.062592 0.063011 0.016250 0.993x 1.025x
bytevector-fill-4k 0.079238 0.077739 0.086083 1.019x 1.002x
hashtable-count-1k 0.457269 0.457966 5.945833 0.998x 1.009x
string-build-1k 0.044859 0.045640 0.042833 0.983x 0.995x
string-scan-4k 0.092585 0.092883 0.043750 0.997x 1.002x
unicode-scan-1k 0.036606 0.035641 0.011750 1.027x 0.990x
datum-read-write-200 1.544089 1.563442 2.275500 0.988x 1.004x
closure-mutate-2k 0.002900 0.002892 0.008417 1.003x 1.002x
higher-order-2k 0.004080 0.004099 0.006333 0.995x 1.000x
callcc-escape-1k 0.092557 0.092952 0.006583 0.996x 0.999x
values-consumer-1k 0.001540 0.001550 0.004417 0.994x 1.001x
dynamic-wind-200 0.152083 0.150965 0.012667 1.007x 0.999x
goops-dispatch-1k 0.787445 0.788164 0.109000 0.999x 1.006x
goops-allocate-200 0.085992 0.085167 0.055375 1.010x 1.012x

Build: vile-resume.dut8zazw. Verification: vile-resume.ciiphipf. Interpreter measurement: vile-resume.5hd2pjoo. Native measurement: vile-resume.wha_qboq. Recovery: validation/integer382/.