TYCHO Search

Search documentation

    ↑ ↓ to move · Enter to open · Esc to close

    Performance: the compiler and the C it emits

    This page is about src/tychoc.c, runtime/tycho_rt.c and the C they emit — how the arena model is kept cheap, and what each mechanism does. For the language's performance story, read performance.md and the thesis.

    It carries one reproducible number, the transpile time below. Everything else describes a mechanism rather than timing one. For figures you can reproduce, make bench runs 17 benchmarks and each bench/*/RESULTS.md records its own hardware.

    Transpile time

    bench/transpile/run.sh measures how long tychoc takes to turn one .ty file into C. It generates a syntax-stable input, verifies the compile succeeds before timing it (a compile that dies is faster than one that works, so an unchecked input reports the failure path as a speed-up), discards a warm-up run, and reports the minimum of N with median and max beside it.

    11 ms minimum of 10 timed runs over a 4.2k-line input — flat, no regression across the measured window.

    What to run

    What the bounds mean

    How the cost is kept down (summary)

    The arena model wins by orders of magnitude where it was designed to (the acc = acc + s loop, rewritten to an in-place O(n) append), and pays a per-scope tax everywhere else: every block scope and call does arena_child / arena_reset / arena_free. Four mechanisms keep that tax off the hot path:

    The tuning diary behind these — profiler notes, blind alleys, and the Ctx-reconstruction and O(n²) fixes — is in internals/runtime-tuning.md.