Performance
Mucc is built to compile fast. The numbers on this page were measured in
October 2026; make bench measures them again, on your own
machine (see How the Numbers Were
Measured). The mucc measured is the release binary, which mucc built,
as the one you download is. (A mucc built by
gcc -O2 compiles about 1.9 times as fast again, as the last
table shows.)
Compiling Mucc's Own Source¶
How long each compiler takes to compile src/*.c to objects:
34,000 lines, 59,884 after preprocessing (the same headers are included in
many files).
| Compiler | Time | Lines per second | Mucc is |
|---|---|---|---|
| Mucc | 0.41 s | 145,000 | |
Clang 21.1 -O0 | 0.92 s | 64,000 | 2.3x faster |
GCC 15.2 -O0 | 1.58 s | 38,000 | 3.9x faster |
Clang 21.1 -O2 | 5.79 s | 10,000 | 14x faster |
GCC 15.2 -O2 | 8.40 s | 7,100 | 20x faster |
Compiling SQLite¶
SQLite's amalgamation, sqlite3.c 3.38.2 (239,379 lines in one
file), the usual test of compile speed. TinyCC is much faster still: it
writes machine code directly, in one pass, and doesn't make assembly. (It
can't compile mucc's own source, which uses __int128.)
| Compiler | Time | Lines per second | Mucc is |
|---|---|---|---|
| TinyCC 0.9.27 | 0.06 s | 4,000,000 | 8.3x slower |
| Mucc | 0.50 s | 476,000 | |
Clang 21.1 -O0 | 0.96 s | 248,000 | 1.9x faster |
GCC 15.2 -O0 | 2.41 s | 99,000 | 4.8x faster |
Clang 21.1 -O2 | 12.98 s | 18,000 | 26x faster |
GCC 15.2 -O2 | 16.93 s | 14,000 | 34x faster |
How Fast Mucc's Code Runs¶
Mucc itself as the program: mucc built four ways, each compiling the same source.
| Mucc built by | Time | Slower than gcc -O2 by |
|---|---|---|
gcc -O2 | 0.24 s | |
gcc -O0 | 0.36 s | 1.5x |
mucc, with glibc (--libc=system) | 0.37 s | 1.5x |
| mucc, with its musl (the default) | 0.45 s | 1.9x |
So the code mucc makes runs about as fast as gcc -O0's. The
bundled musl's malloc and stdio make programs about 1.2 times
slower than with glibc. For the fastest programs, build with gcc or clang
at -O2.
How the Numbers Were Measured¶
On an Intel Core i7-1185G7 laptop under WSL 2, with gcc 15.2, clang 21.1 and tcc 0.9.27: real time, best of 7 with the compilers taking turns, one file at a time. Compilation time includes compilation and assembly.
Your numbers will differ. Measure them on your own machine with:
make bench # mucc's own source
make bench SQLITE3_C=path/to/sqlite3.c # and SQLite's amalgamation
Download the amalgamation from sqlite.org.
test/bench.sh measures clang and tcc too if they're installed.
Why It's Fast¶
- One process, no pipes. The preprocessor, compiler, assembler and linker run in one program, passing text and objects in memory.
- Simple, linear passes. Each stage reads its input once. There is no intermediate representation to optimize over.
- Tuned where the time goes. Tokens hash their names once, the tokenizer and assembler look characters up in tables, assembly lines are written straight into one buffer, and memory comes from an arena in huge pages.
- Code that runs fast enough. Constants are folded, instructions take constants, variables and members as operands in place, and arguments go straight into registers: mucc compiles its own code, so better code makes mucc faster too.