Compare five real examples across four targets on three measured platforms, preserving raw samples, independent output verification and artifact provenance.
Complete the WebAssembly support needed by the examples, inspect ZX bundles, prune generated C dependencies while preserving C++ linkage, and validate native script execution. Optimize only the temporary bootstrap seed and retain fresh-build measurements and historical benchmark records under bench/results.
Local tests: all 522 cases passed across the full run and corrected header-test rerun; all 16 bootstrap modules match. Playground runtime, bundle runtime, private browser layouts and matrix controls, published artifacts and local site links passed.
compiler_text owns the language's integer literal rule (decimal, 0x, 0b,
leading-0 octal, _ separators, full u64 range); ZirIntegerLiteral and enum
values both use it, so enums now accept 0b and _ like the rest of the
language. compiler_scan's NextCodeToken skips line and nested block
comments for the C lexer, whose own copy of that loop is gone.
Under TinyCC on x86-64 the 32-bit multiplies, rounding shifts, half
widening and the signed narrowings are SSE2 assembly macros, and a gather
reads its lanes straight from the table, two to a 64-bit word, instead
of four memcpy calls. Each result is stored as one 128-bit block: the
next operation's 64-bit half loads still forward from it. TinyCC's
assembler learns pmuludq and pshufd.
Where nothing inlines (TinyCC, unoptimized GCC and Clang), zi_simd_at,
zi_simd_gather_check and SliceRange check in place and call only to
report. A whole slice a[:] is the view itself in C, and a vector load,
store or gather of a whole named array addresses the array directly.
TinyCC zeroes small braced locals with stores instead of memset.
AV1's s32x4 self-guided restoration (tree-s3) against its scalar form
(tree-s2), `ziran run`, best of 3 on one core:
d352 cached 95 -> 76 ms (scalar 79 -> 71), uncached 356 -> 336 ms (scalar 328 -> 325)
d1080 cached 488 -> 408 ms (scalar 484 -> 408), uncached 793 -> 703 ms (scalar 802 -> 703)
The bootstrap C is regenerated.
Where a compiler never inlines (TinyCC, unoptimized GCC or Clang), checked
division and shifts (ZiDivS32 and the rest) and index reads (ZIRAN_INDEX,
SliceIndex, ZirVecIndex) are statement-expression macros. Their
temporaries were spelled zi__a, zi__index and the like, so an operand
named the same read the macro's own uninitialized local: ZiDivS32(zi__a,
zi__b, ...) divided garbage, and a slice index named zi__slice_index
aborted. They are now spelled __zi_*, which C reserves and the C emitter
renames in programs, as the std/simd macros already are.
tests/macro_temporaries.sh checks both spellings at -O0, -O2 and under
`ziran run`. The bootstrap C carries the new prelude.
TinyCC never inlines, so under `ziran run` every call of a tiny helper
paid a full call with all its locals on the stack. Generated C now writes
a call of a small straight-line procedure of the same module (no loops,
no module variables, scalars, pointers and small records only) as its
body in a block: arguments still run once, left to right, a return jumps
past the body, and the inlined call still costs the step its entry did.
Calls of foreign procedures stay out of inlined bodies, and private
procedures are declared ZIRAN_MAYBE_UNUSED for when every caller inlined
them.
A 1080p AV1 decode runs about 7% faster under `ziran run` and 4% faster
at -O0 with the same output; -O3 is unchanged. The bootstrap C is
regenerated. tests/call_site_inlining.sh covers argument order, name
clashes, early returns and the warning-free build.
TinyCC and unoptimized GCC or Clang never inline, so every bounds check,
checked shift and checked division in generated C cost a helper call.
Under those compilers the helpers are now statement-expression macros that
check in place and call out only to fail; optimized builds keep the
functions. A 1080p AV1 decode runs about 17% faster under `ziran run`
(TinyCC) and 24% faster at -O0, with the same output; -O3 is unchanged.
Generated C leaves out the bounds check of an index such as
row * stride + column when a guard bounds it: an earlier if that returns,
breaks or continues, an enclosing if or while condition, or the earlier
operands of && and ||, until a value they compare changes. Indexes and
guard comparisons become polynomials over parameters, invariant locals
and slice counts; each loop counter is replaced by its upper bound, and
the index is proven below the count or length when every step is exact.
Guards that miss the read, values moved after the guard and else-if
exits keep their checks.
On the AV1 benchmark (fixed binaries, interleaved, one core) 1080p q20
drops from 185.1 to 182.2 ms and 720p 4:4:4 is unchanged, but 1080p
10-bit q30 rises from 201.5 to 212 ms. All of that comes from the one
check left out of FindCdefDirection's sample read; the function alone runs
faster without it (102 against 105 ns per call), so the loss is a layout
effect in the decoder's context.