Docs/Reference/Benchmarks
Benchmarks
Fid measured against Rust, Zig, C++ and Go on four programs, with every result the project has, losses included, and how to reproduce them.
~3 min read
On this page
Every result the project has, losses included. The source of these numbers is docs/benchmarks.md in the compiler repository; if a number is wrong, open an issue.
What is measured
Four programs, each written in Fid, Rust, Zig, C++ and Go, in the repository’s bench/ folder:
| Program | What it measures |
|---|---|
fib | Recursive calls: fib(40) |
loop | Integer arithmetic in a counted loop, 2 billion times |
sieve | A 20-million-entry array, written and read in loops |
hashmap | One million string keys inserted, then looked up |
Each program prints one number, and a language that prints a different number is marked wrong, not timed. Fid is measured two ways: native (fid emit, no C compiler) and through C (fid ccompile with zig cc). The others are built as their users ship them: rustc -C opt-level=3, Zig ReleaseFast, Clang -O2, go build. Times are wall-clock seconds for the whole process, best of three.
Results
Nov 15, 2026
A busy shared machine (AMD Ryzen 7, 8 cores, Windows 11), so read these as noisy. Native Fid was not measured that day: the working tree could not build natively, and the column is left out rather than filled from another day.
| Benchmark | Fid via C | Rust | Zig | C++ | Go |
|---|---|---|---|---|---|
| fib | 1.07 | 0.66 | 0.68 | 0.66 | 0.96 |
| hashmap | 0.87 | 1.82 | - | 1.48 | 2.01 |
| loop | 4.95 | 3.94 | 3.24 | 5.05 | 4.05 |
| sieve | 0.37 | 0.28 | 0.28 | 0.29 | 0.39 |
Through C, Fid is fastest on hashmap, 1.6 times the fastest on fib, 1.3 times on sieve and 1.5 times on loop. Zig has no hashmap program yet.
Nov 3, 2026
Windows 11 x64, one laptop, best of three.
| Benchmark | Fid native | Fid via C | Rust | Zig | C++ | Go |
|---|---|---|---|---|---|---|
| fib | 1.37 | 0.92 | 0.59 | 0.64 | 0.61 | 0.96 |
| hashmap | over 60 s | 0.85 | 1.34 | - | 1.29 | 0.94 |
| loop | 8.58 | 3.78 | 3.21 | 3.76 | 3.99 | 3.12 |
| sieve | 0.80 | 0.55 | 0.26 | 0.29 | 0.26 | 0.30 |
Native output was two to three times slower than through C (the native backend had no optimizer then), and native hashmap was quadratic.
Nov 2, 2026
The earlier run on the same machine, kept because it differs: Rust’s loop took 5.36 s here and 3.21 s a day later, which shows how noisy one laptop is.
| Benchmark | Fid native | Fid via C | Rust |
|---|---|---|---|
| fib(40) | 1.34 | 0.81 | 0.53 |
| loop, 2 billion | 7.59 | 3.53 | 5.36 |
| sieve, 20M | 0.82 | 0.48 | 0.40 |
| hashmap, 1M strings | 1.04 | 0.80 | 1.12 |
Known weak spots
fibis about 1.5 times Rust through C and over twice natively. Fid checks every addition for overflow; Rust’s release mode does not.sievewas about twice the others on Nov 2–3 and 1.3 times on Nov 15.- Native output (
fid emit) is slower than through C on every program measured. - Compile speed: the compiler compiles its own source to C in about 40 s (Nov 15). That is the widest gap to Go and Zig.
Not measured yet
The Benchmarks Game set, real workloads (JSON, regex, sorting), service benchmarks with the client on another machine, binary size and memory, Linux runs, and the spread across several runs.
Reproduce it
./bench/run.sh # every program, every language, best of 3
RUNS=5 ./bench/run.sh fib sieve # some programs, best of 5run.sh builds every program, checks that all languages print the same number, and prints a table with the toolchain versions. It needs Bash, zig 0.16, rustc and go.
Good to know: a corrected program for another language replaces ours, and a result that makes Fid look worse is as welcome as one that makes it look better.