Skip to content
rtfeldman.com·

🚀Lean 4 DEFLATE Library Outperforms Rust, Falls Short of C

Lean 4's DEFLATE library beats Rust but can't touch C

TL;DR

Lean 4's lean-zip DEFLATE library outperformed Rust's miniz_oxide but couldn't match C's libdeflate. At its fastest, lean-zip was 15% faster and produced smaller files. Roc, a new language, also entered the fray but lagged behind.

Lean 4's lean-zip DEFLATE library outperformed Rust's miniz_oxide across the board, achieving 15% faster compression and producing 8.8% smaller files at its fastest setting. However, it couldn't match the performance of C's libdeflate, which hit speeds of up to 601.03 MB/s. Roc, a new functional language, also joined the DEFLATE race but its roc-deflate package was 144 benchmarks slower on average, with the median case being 8.9% slower on Ryzen 9 3900X and 2.6% on M1 MacBook Pro. Lean 4's lean-zip is a significant win for statically-typed functional languages in high-performance computing tasks, but the gap with C remains substantial.

Key Points

1

Lean 4's lean-zip library outperformed Rust's miniz_oxide at all compression levels, achieving up to 15% faster speeds and 8.8% smaller file sizes.

2

Lean 4's lean-zip library hit speeds of up to 601.03 MB/s at its fastest setting, outperforming Rust's miniz_oxide.

3

Roc's roc-deflate package, while showing promise, was 144 benchmarks slower on average than libdeflate, with the median case being 8.9% slower on Ryzen 9 3900X.

4

Roc's roc-deflate package achieved up to 529.49 MB/s at L1 compression, still falling short of libdeflate's 601.03 MB/s.

5

Roc's roc-deflate package showed the most promise at L1 compression but still lagged behind libdeflate's 601.03 MB/s speed.

Why It Matters

If you're working on high-performance compression tasks in Rust, Lean 4's lean-zip library could offer a significant speed boost. However, for critical applications requiring top-tier performance, C's libdeflate remains the gold standard. Roc, while promising, still has a long way to go before it can compete with established solutions.

Lean 4RustlibdeflateDEFLATEcompressionperformance

Comments

Subscribe to join the conversation...

Be the first to comment

Enjoyed this article?

Get it daily. 7am. Free. Reads in 5 minutes.

Join 3,565 builders reading daily.

Also get