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:
13
benchmarks/ackermann.zig
Normal file
13
benchmarks/ackermann.zig
Normal 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});
|
||||
}
|
||||
Reference in New Issue
Block a user