feat: add comprehensive benchmark suite with flake commands

- Add nix flake commands: bench, bench-poop, bench-quick
- Add hyperfine and poop to devShell
- Document benchmark results with hyperfine/poop output
- Explain why Lux matches C (gcc's recursion optimization)
- Add HTTP server benchmark files (C, Rust, Zig)
- Add Zig versions of all benchmarks

Key findings:
- Lux (compiled): 28.1ms - fastest
- C (gcc -O3): 29.0ms - 1.03x slower
- Rust: 41.2ms - 1.47x slower
- Zig: 47.0ms - 1.67x slower

The performance comes from gcc's aggressive recursion-to-loop
transformation, which LLVM (Rust/Zig) doesn't perform as aggressively.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-16 05:53:10 -05:00
parent 8a001a8f26
commit 49ab70829a
10 changed files with 543 additions and 166 deletions

13
benchmarks/ackermann.zig Normal file
View File

@@ -0,0 +1,13 @@
// Ackermann function benchmark - deep recursion
const std = @import("std");
fn ackermann(m: i64, n: i64) i64 {
if (m == 0) return n + 1;
if (n == 0) return ackermann(m - 1, 1);
return ackermann(m - 1, ackermann(m, n - 1));
}
pub fn main() void {
const result = ackermann(3, 10);
std.debug.print("ackermann(3, 10) = {d}\n", .{result});
}