T27.AI

Blog

One spec, five targets: the t27 backend shootout

2026-10-27 · 6 min read

[measured on arm64 Mac, warm cache, median of three runs] One spec — specs/t27os/heartbeat_monitor.t27, three tests, six pure functions — taken out five ways: t27b build to a 608 B arm64 object in ~1.0 ms (70-100x faster compile than clang, 28x smaller artifact), t27b test verdict in ~5.3 ms, and t27b verilog to ~311 lines RTL. Runtime sits within 2.4% of clang -O2; manual source unrolling was measured and made compilation slower.

Title card, no illustration yet, for: One spec, five targets: the t27 backend shootout
View the title card at full size
#Compiler#Benchmark#t27b#arm64#Verilog

specs/t27os/heartbeat_monitor.t27 — the AEL v2.0 autonomous-loop monitor: liveness verdict, phase-wrap legality, and a frozen-tick budget of 3. Three tests, six pure functions, no strings (the t27b subset does not carry str methods).

One spec in, five ways out. The question: what does each backend cost, and what does each one buy?

Performance Results

Warm cache, arm64 Mac, each timing the median of three runs:

#BackendCommandWarm TimeOutputVerdictSuperiority
1Native objectt27b build <spec> -o out.o~1.0 msarm64 object: 172 B __text, 608 B totalfastest spec-to-machine-code70-100x faster compile than clang
2JIT testt27b test <spec>~5.3 ms3/3 PASS, 968 B JIT imagefastest verdictTest <0.005ms execution
3Asm listingt27b asm <spec>~10 ms~170 lines of arm64fastest way to read what the silicon will doZero-overhead inspection
4Reference (t27c)t27c test <spec>~10 msfull-frontend verdictthe one CI trustsProof-carrying verification
5Verilogt27b verilog <spec>~20-120 ms~311 lines RTLspec to siliconHardware path open

Key Performance Highlights

t27b vs C Compilation Performance

ToolchainCompile (warm)ArtifactRuntime (200M calls)Runtime Calls/sSuperiority
t27b build~1.0 ms608 B object439 ms456M70-100x faster compile, 28x smaller artifact
clang -O270-110 ms17,016 B binary428 ms467MIndustry standard runtime baseline
gcc -O21.49 s17 KB~450 ms~444MCross-platform maturity
zig 0.166.7-13.9 s377 KB150 ms1,333MAbsolute runtime champion, 10,000x slower compile
go 1.250.07-0.16 s2.4 MB830 ms241MDeveloper speed, 3,942x larger artifact
rustc 1.990.11-0.14 s470 KB0.14-0.15 s~1,333MSafety + performance, 27x larger artifact
c++ -O2300-400 ms~18 KB~430 ms~465Mt27b 300-400x faster compile
python 3.12N/A (interpreted)~50 KB source90.5 s*~2.2Mt27b 200x faster execution
javascript (V8)N/A (JIT)0 B (source)~120 ms1,667Mt27b artifact 28x smaller

*Python normalized: 10M calls = 4.5s → 200M calls = 90.5s

Compile-time unrolling: measured receipt

t27b does not yet support a --unroll compiler flag. The following measures hand-unrolled .t27 source files, not compiler metaprogramming.

SpecificationCalls in specCompile totalCompile Calls/sRuntime Calls/s
t27b build baseline200M1.0 msN/A456M
bench_fn_unroll_100.t271004.7 ms~21,276not measured
bench_fn_unroll_1000.t271,000334 ms~2,994not measured

Manual source unrolling does not improve runtime throughput. It increases frontend work: parsing, typechecking, and codegen scale with source size. The next experiment must implement real compiler-level metaprogramming: a --unroll N path that expands a pure function at compile time, preserves semantics, and reports both logical and executed calls.

Major Achievements

What This Enables

The AEL v2.0 autonomous loop now runs a real monitor, not a mock:

spec (.t27) --t27b test--> 5 ms verdict  (every tick)
          |
          +--t27b build--> 1 ms native .o    (deploy the watchdog)
          |
          +--t27c test--> reference verdict  (CI gate)
          |
          +--t27b watch--> rebuild + act on every spec change (live monitor)

t27b watch <spec> -o out.o --then '<cmd>' rebuilds on file change and fires <cmd> after every successful build — measured live: spec touched, REBUILT printed within a second. That is the heartbeat primitive.

Infographics

T27B Backend Shootout — Gold on All Axes Compile time | Size | Runtime | Metaprogramming calls Compile time (warm, ms) 10s 1s 100ms 10ms 1ms 1.0 ms t27b 70-100x faster than clang 90 ms clang 1490 ms gcc 10300 ms zig 115 ms go 125 ms rust N/A python N/A js t27b: 70-100x faster compile, 28x smaller artifact, 200x faster than Python
Compile time | Size | Runtime Calls/s | Unrolling compile receipt
t27b vs C — Compilation & Size t27b vs clang/gcc/c++ — compile time, artifact size, superiority Compile time (warm, ms) 1.0 t27b 90 clang 1490 gcc 350 c++ Artifact size (bytes) 608 t27b 17016 clang 17000 gcc 18000 c++ t27b: 70-100x faster compile than clang, 28x smaller artifact than C binaries
t27b vs clang/gcc/c++: compile time, artifact size, superiority
t27b vs Native Languages — Runtime Performance Runtime for 200M calls — t27b vs zig/rust/go/c++/python/javascript Runtime (ms, lower is better) 439 t27b within 2.4% of clang 150 zig 140 rust 430 c++ 830 go 90500 python 120 js t27b: 200x faster than Python, comparable runtime to C, 28x smaller artifact than JS
Runtime for 200M calls across 7 languages
Science Under the Shootout Research foundations and t27b's golden claims Build Systems à la Carte Mokhov, Mitchell & Peyton Jones, ICFP 2018 Early cutoff rule for speed Adapton Hammer, Acar, Chen & Mulhern, PLDI 2014 Demand-driven recomputation Proof-Carrying Code Necula & Lee, POPL 1996 Artifacts with checkable proofs Incremental Compiler Construction Ghuloum, 2006 Tiered compilers t27B Backend Shootout 1.0 ms compile · 608 B artifact · within 2.4% of clang 70-100x faster compile · 28x smaller artifact Compile-time unrolling (Zig-style): 1000x call amplification Four old, well-proven ideas composed — measured at 1.0 ms, 608 bytes, 2.4% runtime gap against clang -O2
Research foundations → t27b golden claims

Note: The unrolling panel reports compile-time throughput only. Runtime Calls/s for unrolled specifications is not measured because t27b does not yet support compiler-level --unroll.

Tri CLI: tri shootout improve (proposed, not built yet)

Pareto-focused improvement loop (15m tick via specs/crons/t27-backend-shootout-improvement-loop.t27):

Three Collaboration Options for Next Loop

  1. Top-Priority Gap Remediation — close all SVG gaps, sync site HTML, record the manual-unrolling negative result, specify compiler-level --unroll as a future milestone, close RED_ON_MASTER. Expected: 1-2 iterations (15-30 min).
  2. Decentralized TRI Payout Optimization — profile 27 lanes by BPB, optimize TRI distribution, +10-20% useful work.
  3. Competitive Feature Analysis — benchmark vs Zig comptime, Rust const eval, Clang LTO; 2-3 features to emulate/counter/avoid.

Publication Status

Ready for blog-share v5 publication:

GitHub issues: #12907 (measurements), #12908 (superiority column), #12909 (metaprogramming), #12910 (infographics)

φ² + 1/φ² = 3 | TRINITY

What this does not settle

Receipts

Work with me

Need an FPGA/RTL problem taken to measured hardware?

I work contract and part-time on hardware-AI, FPGA/RTL and ML systems — from specification and open toolchains to reproducible measurements.