HeadlinesBriefing HeadlinesBriefing.com

Lean 4 Outperforms Rust in DEFLATE Compression Benchmarks

Hacker News •
×

October 22, 2026 - In "Why Lean is Faster Than Rust," the author demonstrates that a DEFLATE compression library written in Lean 4, a functional programming language and proof assistant, outperforms an equivalent Rust package from crates.io with over a billion downloads. At its fastest setting, Lean 4 provides the same compression at higher throughput, achieving 15% quicker performance and 8.8% smaller output. However, Lean 4 was no match for libdeflate, the DEFLATE implementation written in C.

While libdeflate benefits from carefully tuned architecture-specific SIMD that functional languages cannot currently access, the article introduces Roc, a functional programming language focused on runtime performance. Despite being weeks away from its first numbered release and having a nascent package ecosystem, Roc's roc-deflate package, written by Niclas Ahden, was benchmarked against libdeflate using the Silesia corpus. On average, roc-deflate ran 8.9% slower on AMD Ryzen 9 3900 X and 2.6% slower on M1 Mac Book Pro.

On worst-case inputs, roc-deflate was 18% slower, but on best-case inputs, it was slightly over 18% faster. While C maintains a higher performance ceiling, Roc offers memory safety with automatic reference counting and bounds checking, providing stronger safety guarantees than C, Zig, or Rust.

Source: Hacker News · Summarized by HeadlinesBriefing