En kodare

Anders Hovmöller
GitHub
twitter
email
About Blog Apps

Mojo deflate vs C

2026-10-26

I read Richard Feldman’s post How close can pure FP get to C?, and this quote caught my attention:

However, the article also notes that while they managed to surpass Rust’s miniz_oxide, they were no match for the end boss of DEFLATE performance: libdeflate, written in C.

I’ve been playing around with Mojo, and I wondered how close to C performance we could get, so I sent Claude on it. Along the way I had Claude build a mutation tester for Mojo that I named despell.

All in all, the Mojo version managed to beat libdeflate, if only by a narrow margin. Claude found some minor tricks it could employ very easily with Mojo’s comptime feature to edge ahead. As Claude also said, this could all be implemented in the C version too, it’s just a bit more cumbersome.

« Smoother translations in Django