TL;DR
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
A report published October 22, 2026, says a heavily optimized DEFLATE compressor written in the functional language Roc ran a median 8.9% slower than the C library libdeflate on an AMD Ryzen system and 2.6% slower on an M1 MacBook Pro. The results cover one package and a specific benchmark corpus; they do not establish how Roc performs across software generally.
A DEFLATE compression library written in the functional language Roc ran within a single-digit median performance gap of the C library libdeflate in benchmarks on two machines, according to a report published October 22, 2026. The result suggests that optimized Roc code can approach a highly tuned C implementation on this task, while remaining slower on average and offering different memory-safety guarantees.
The report’s author tested roc-deflate, a package written by Niclas Ahden and used in paid production work, against libdeflate. The benchmarks used the Silesia compression corpus, covered 144 benchmark results, and checked that the implementations produced identical outputs. Testing took place on a 2021 M1 MacBook Pro and an AMD Ryzen 9 3900X running Ubuntu. The comparison was limited to non-streaming APIs because roc-deflate did not yet support streaming.
Across the benchmark results, roc-deflate’s median slowdown was 8.9% on the Ryzen system and 2.6% on the M1, relative to libdeflate. Performance varied by input: the report says Roc was as much as 18% slower on the worst cases and slightly more than 18% faster on the best. Those individual wins reflect differences between the two implementations on particular inputs, not proof that Roc has a general performance advantage.
The author says Roc’s compiler optimization pipeline removed many bounds checks and reference-counting operations when it could establish they were safe to eliminate. The report contrasts that design with libdeflate’s use of architecture-specific SIMD and C’s ability to operate without language-mandated bounds checks. It also stresses that the comparison is not a general test of functional programming: it concerns one carefully optimized package, written in a language whose first numbered release, 0.1.0, was described as still weeks away.
Safety Trade-Offs in Compression
The benchmark puts a concrete number on a question relevant to developers choosing languages for performance-sensitive software: how much speed might they give up for enforced memory safety and a functional programming model? In this case, the reported median gap against libdeflate was under 9% on both machines, though the exact result differed by processor and input.
That gap may matter where developers want to reduce exposure to memory errors without accepting a large performance penalty. The report says Roc enforces memory safety and automatic reference counting and provides no facility to opt out of those protections. Its compiler can still remove checks it proves unnecessary. These characteristics are the author’s description of Roc; the benchmark itself measures compression throughput and output equivalence, not security outcomes.
The findings do not show that Roc can replace C for all systems work. The author explicitly says C retains a higher performance ceiling and could close the cases where roc-deflate was faster. The practical significance is narrower: a functional, memory-safe implementation came close to a highly tuned C library on a demanding compression task, giving other developers a result to test against rather than a broad guarantee.
As an affiliate, we earn on qualifying purchases.
From Lean Benchmarks to Roc
The report was prompted by a separate result discussed in an article titled “Why Lean is Faster Than Rust.” That article described lean-zip, a DEFLATE library in Lean 4, beating the Rust package miniz_oxide at the compression levels tested. The same account said lean-zip did not match libdeflate, a carefully tuned C implementation using architecture-specific SIMD. Those results set up a different comparison: whether Roc, a functional language designed with runtime performance as a goal, could get closer to libdeflate.
The report’s author says Roc is an early-stage language and that its package ecosystem has had little optimization work. The effort described was unusually intensive for a Roc package: the author spent substantial time optimizing roc-deflate before running the comparisons. That qualification matters. A result obtained after focused tuning on one package may not represent typical Roc code, and the report says the number of other optimized Roc codebases is too small to judge how well the result generalizes.
Roc also distinguishes pure functions from effectful ones in its type system, according to the report. The author points to this property, alongside enforced memory safety, as a possible benefit of implementing compression directly in Roc rather than using a C library. The benchmarks do not quantify the development, maintenance, or security costs of either approach.
““Under 10% Slower””
— The report’s author
As an affiliate, we earn on qualifying purchases.
How Far the Results Generalize
The benchmark does not establish how Roc compares with C across other workloads, machines, or software projects. It covers one compressor, a particular corpus, two systems, and non-streaming APIs. The report does not provide evidence that typical Roc programs would achieve similar results or that the measured gap would hold under other compiler settings or workloads.
The report also does not establish that Roc’s safety model prevents every security flaw. It describes language-level memory-safety guarantees and optimization behavior, but the benchmark tested output and speed, not vulnerabilities. The size of any performance trade-off in broader use remains unknown, as does how results might change as Roc and its ecosystem develop.
USB-C external SSD for compression benchmarks
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
More Packages Needed for Comparison
The clearest next step is to optimize and benchmark a wider range of real-world Roc programs against established implementations. The report names broader testing as necessary to determine whether this compression result is repeatable beyond roc-deflate. Future comparisons would also need to cover more hardware, workload types, and APIs, including streaming if Roc’s package gains that capability.
Until then, the reported figures are a benchmark result, not a forecast of general language performance. Developers considering Roc for performance-critical work can treat the compression comparison as evidence that focused optimization can produce competitive results in at least one case, while testing their own workloads before drawing conclusions.
As an affiliate, we earn on qualifying purchases.
Key Questions
Did Roc beat libdeflate overall?
No. The report says roc-deflate was slower at the median: 8.9% on an AMD Ryzen 9 3900X and 2.6% on an M1 MacBook Pro. It was faster on some individual inputs and slower on others.
What was tested?
The report compared roc-deflate with libdeflate on the Silesia compression corpus, using non-streaming APIs. It says the implementations’ outputs were checked for equivalence and that the work covered 144 benchmark results across two machines.
Does this prove functional programming is as fast as C?
No. It is a result for one intensively optimized Roc package and one compression workload. The report’s author says the result cannot be generalized without benchmarks across more Roc codebases and real-world tasks.
Why use Roc instead of calling a C library?
The report points to Roc’s enforced memory safety, automatic reference counting, and functional design. Those features may appeal to developers, but the benchmark does not measure their broader development or security benefits against the performance cost.
Source: hn
Halloween Picks
halloween
As an affiliate, we earn on qualifying purchases.
