c897d2eef0
Closes the question CLAUDE.md has carried since day one ("LLVM-
linkable, performance is extremely important") with data. Hand-C
variants of the four bench fixtures, compiled with clang -O2,
each carefully matching the AILang algorithm and explicitly
documenting representation differences (cell width, leak policy)
that affect the ratio.
Three substantive findings:
1. Pure-compute parity with C: bench_compute_collatz runs at
AILang/C = 0.99x across both allocators. AILang's IR composes
with LLVM's optimizer at the same level a hand-C source does.
This is the LLVM-linkable performance claim, backed by data
for the first time. bench_compute_intsum (1.05-1.18x) confirms.
2. AILang bump beats glibc malloc 2x on linear allocation:
bench_list_sum.bump/c = 0.50x. Bump's two-instruction inline
fastpath outperforms glibc's free-list-managed malloc on
no-free workloads. Quantitatively measured for the first time.
3. RC overhead vs C malloc quantified: bench_list_sum.rc/c =
1.49x, bench_tree_walk.rc/c = 2.61x. The 8-byte refcount
header + zero-init + libc backing add 50-160% over glibc
malloc on these implicit-mode workloads. Explicit-mode + a
free()-adding C variant (21'f, queued) will close the
apples-to-apples gap on dec-cost.
CLAUDE.md updated to list bench/cross_lang.py as the third
tidy-iter gate alongside bench/check.py and bench/compile_check.py.
20 new metrics in bench/baseline_cross_lang.json with 12-15%
tolerances (cross-language ratios are inherently noisier than
within-AILang ratios — two compiler stacks contribute variance).
97 lines
2.3 KiB
JSON
97 lines
2.3 KiB
JSON
{
|
|
"version": 1,
|
|
"captured": "2026-05-09",
|
|
"captured_via": "bench/cross_lang.py",
|
|
"note": "Cross-language wall-time baseline. Per-fixture: AILang at --alloc=rc, AILang at --alloc=bump, hand-C at clang -O2. Ratios rc/c and bump/c are the headline answer to CLAUDE.md's LLVM-linkable performance claim. The C reference uses malloc-and-leak to mirror AILang's implicit-mode RC; an explicit-mode + free() variant is queued.",
|
|
"fixtures": {
|
|
"bench_list_sum": {
|
|
"ail_rc_s": {
|
|
"baseline": 0.141597,
|
|
"tolerance_pct": 15
|
|
},
|
|
"ail_bump_s": {
|
|
"baseline": 0.048038,
|
|
"tolerance_pct": 15
|
|
},
|
|
"c_s": {
|
|
"baseline": 0.095312,
|
|
"tolerance_pct": 15
|
|
},
|
|
"rc_over_c": {
|
|
"baseline": 1.485614,
|
|
"tolerance_pct": 12
|
|
},
|
|
"bump_over_c": {
|
|
"baseline": 0.504003,
|
|
"tolerance_pct": 12
|
|
}
|
|
},
|
|
"bench_tree_walk": {
|
|
"ail_rc_s": {
|
|
"baseline": 0.097028,
|
|
"tolerance_pct": 15
|
|
},
|
|
"ail_bump_s": {
|
|
"baseline": 0.038905,
|
|
"tolerance_pct": 15
|
|
},
|
|
"c_s": {
|
|
"baseline": 0.037159,
|
|
"tolerance_pct": 15
|
|
},
|
|
"rc_over_c": {
|
|
"baseline": 2.611185,
|
|
"tolerance_pct": 12
|
|
},
|
|
"bump_over_c": {
|
|
"baseline": 1.046998,
|
|
"tolerance_pct": 12
|
|
}
|
|
},
|
|
"bench_compute_intsum": {
|
|
"ail_rc_s": {
|
|
"baseline": 0.00044,
|
|
"tolerance_pct": 15
|
|
},
|
|
"ail_bump_s": {
|
|
"baseline": 0.000393,
|
|
"tolerance_pct": 15
|
|
},
|
|
"c_s": {
|
|
"baseline": 0.000374,
|
|
"tolerance_pct": 15
|
|
},
|
|
"rc_over_c": {
|
|
"baseline": 1.177715,
|
|
"tolerance_pct": 12
|
|
},
|
|
"bump_over_c": {
|
|
"baseline": 1.050856,
|
|
"tolerance_pct": 12
|
|
}
|
|
},
|
|
"bench_compute_collatz": {
|
|
"ail_rc_s": {
|
|
"baseline": 0.056878,
|
|
"tolerance_pct": 15
|
|
},
|
|
"ail_bump_s": {
|
|
"baseline": 0.056547,
|
|
"tolerance_pct": 15
|
|
},
|
|
"c_s": {
|
|
"baseline": 0.05748,
|
|
"tolerance_pct": 15
|
|
},
|
|
"rc_over_c": {
|
|
"baseline": 0.989523,
|
|
"tolerance_pct": 12
|
|
},
|
|
"bump_over_c": {
|
|
"baseline": 0.983756,
|
|
"tolerance_pct": 12
|
|
}
|
|
}
|
|
}
|
|
}
|