TL;DR
An October 22 report says the Roc functional-language package roc-deflate ran a median 8.9% slower than the C library libdeflate on an AMD Ryzen 9 3900X, and 2.6% slower on an M1 MacBook Pro. The result came from 144 compression benchmarks on the Silesia corpus; it does not show that Roc generally matches C, and the author says broader testing is needed.
A DEFLATE compression package written in Roc, a functional programming language, ran within a single-digit median percentage of the highly optimized C library libdeflate in a 144-test benchmark, according to a report published October 22. The result offers a specific example of how close a memory-safe functional implementation can come to C on a performance-critical task, but it does not establish that Roc code generally performs at that level.
Get the latest gadgets delivered free with Prime
- Fast, free delivery on millions of items
- Prime Video, Amazon Music and more included
- Member-only deals all year
The author tested roc-deflate, a Roc package written by Niclas Ahden and used in paid production work, against libdeflate using the Silesia compression corpus. The tests covered compression levels and ran on a 2021 M1 MacBook Pro and an Ubuntu machine with an AMD Ryzen 9 3900X. The author says the outputs were checked for identity and that the report summarizes 144 benchmarks.
In the median case, roc-deflate was 2.6% slower on the M1 and 8.9% slower on the Ryzen. Results varied by input: the Roc package was as much as 18% slower in a worst case and slightly more than 18% faster in a best case. The author cautions that those wins reflect differences between the two implementations and do not mean Roc is faster on average.
The comparison followed a separate result involving lean-zip, a Lean 4 DEFLATE library reported to outperform Rust’s miniz_oxide at the tested compression levels. That library remained behind libdeflate, which the Roc report describes as a carefully tuned C implementation using architecture-specific SIMD. The Roc benchmark targets non-streaming APIs; roc-deflate had not implemented streaming when the tests were run.
A Narrow Gap With Safety Trade-offs
The benchmark puts a measurable number on a question relevant to developers choosing languages for performance-sensitive software: how much speed may be sacrificed for memory safety and other language guarantees? According to the report, Roc provides automatic reference counting and bounds checks and does not offer a way to disable those protections. The author says the compiler can eliminate checks and reference-counting operations when it proves they are unnecessary.
Those design choices distinguish Roc from C, where programmers can work directly with memory but must manage the associated risks. They also matter to teams evaluating whether a functional language can handle practical, low-level workloads without relying on a C implementation. The reported figures are promising for this particular compressor, but they are not a general-purpose language ranking or evidence that replacing C code will usually preserve its speed.
The author also notes that a C implementation could in principle close the cases where roc-deflate was faster. In other words, the best-case result does not establish a higher performance ceiling for Roc. The narrower finding is that, after substantial optimization work, this Roc package came close to a tuned C library on the tested machines and inputs.
Products Worth Considering

Apple MacBook Air 15-inch Laptop with M5 Chip, 24GB Memory, 1TB SSD, Midnight

Apple AirPods Pro 3 Wireless Earbuds with Active Noise Cancellation

Apple Watch Series 12 GPS 42mm Smartwatch
As an affiliate, we earn on qualifying purchases.
From Lean Benchmarks to Roc
The report was prompted by an earlier article, “Why Lean is Faster Than Rust,” which described lean-zip outperforming the Rust package miniz_oxide in its tested compression comparisons. That account also found libdeflate ahead of Lean. The Roc author used that gap as a reason to test a language designed with runtime performance as an explicit goal.
Roc was still weeks away from its first numbered release, 0.1.0, according to the report, and its package ecosystem had received little optimization work. The author says the effort spent tuning roc-deflate was likely the most optimization work yet applied to a Roc package. That makes the outcome noteworthy as a demonstration, while also limiting what can be inferred about typical Roc software.
The report compares implementations of the same compression task, not languages in isolation. Results depend on compiler behavior, implementation choices, processors, inputs and settings. Libdeflate’s use of architecture-specific SIMD is part of the comparison; the reported outcome does not show that Roc can use the same techniques or attain the same ceiling.
“Under 10% Slower”
— The report’s author
How Far the Result Generalizes
The report does not establish how Roc performs across other applications, hardware or workloads. The author says the benchmark represents an unusually intensive optimization effort for a Roc package and that how closely other packages could approach the result is unknown. The published comparison also covers non-streaming compression APIs, so it does not address streaming performance.
The supplied account gives median and best- and worst-case relative results, but does not provide enough benchmark detail here to independently assess every measurement or reproduce the tests. It does not establish that Roc is broadly as fast as C, or that its safety properties make it suitable for every use case. Broader testing and further optimization could change the picture.
More Roc Workloads Needed
The next useful test is whether similar performance holds across a wider set of real-world Roc programs, rather than one heavily optimized compression package. The report does not announce a follow-up date or a new benchmark release. It says the general result remains unknown until more Roc codebases receive optimization work and are measured against comparable implementations.
For now, the benchmark is a point-in-time comparison on two processor platforms, using one compression corpus and non-streaming APIs. Developers considering Roc for performance-critical work will need results from their own workloads, alongside further measurements as the language, compiler and package ecosystem develop.
Key Questions
What did the Roc benchmark find?
The report says roc-deflate was a median 2.6% slower on an M1 MacBook Pro and 8.9% slower on an AMD Ryzen 9 3900X than libdeflate in 144 DEFLATE compression benchmarks.
Was Roc faster than C in any tests?
Yes. The report says roc-deflate was slightly more than 18% faster in its best-case input comparison. The author says this reflects differences between the implementations and does not mean Roc was faster on average.
Does this show Roc is generally as fast as C?
No. The result concerns one optimized compression package, two machines and a particular benchmark corpus. The report says broader testing is needed to learn whether the result generalizes.
What advantages does Roc offer over C?
The report points to memory safety, automatic reference counting and bounds checks, which Roc does not let programmers disable. Its compiler can optimize away some checks when it proves they are safe to remove.
Did the test include streaming compression?
No. The comparison covered non-streaming APIs because roc-deflate had not implemented streaming at the time of the report.
Source: hn
