How Close Can Pure Functional Programming Get To C?
AIThis post was created with the assistance of artificial intelligence (AI).

TL;DR

Buying for a business?Offer from Amazon

Get business pricing on networking and server gear

  • Business-only prices and quantity discounts
  • Tax-exempt purchasing
  • Multiple users, one account, clear invoices
As an affiliate, we earn on qualifying purchases.

A report published Oct. 22 says an optimized DEFLATE compressor written in the functional language Roc ran a median 2.6% slower than the C library libdeflate on an M1 MacBook Pro, and 8.9% slower on an AMD Ryzen 9 3900X. The benchmark covered 144 tests, not a broad set of applications; the result suggests Roc can approach C performance in this task, but does not establish how well that generalizes.

A DEFLATE compressor written in the functional language Roc ran a median 2.6% slower than the C library libdeflate on an M1 MacBook Pro and 8.9% slower on an AMD Ryzen 9 3900X, according to a report published Oct. 22. The comparison covered 144 benchmarks and suggests that Roc can approach highly optimized C performance for this compression workload, though it does not show that the result applies to other software.

The report’s author optimized roc-deflate, a DEFLATE compression package written in Roc, then compared its non-streaming APIs with libdeflate using the Silesia compression corpus. The author said the test outputs were verified to be identical. The figures are median slowdowns across the reported benchmark results: 8.9% on the Ryzen 9 3900X running Ubuntu and 2.6% on the 2021 M1 MacBook Pro.

Performance varied by input. The report says roc-deflate was 18% slower in its worst cases and slightly more than 18% faster in its best cases. Those individual results do not mean Roc is faster overall: the report says libdeflate was faster in the median comparison. The author attributes the variation to differences between the two implementations and says a Roc win on a particular input should not be expected on average.

The comparison is between separate implementations, not a controlled test of the languages alone. Libdeflate is described in the report as a carefully tuned C implementation using architecture-specific SIMD. Roc is a newer language with automatic memory management, bounds checks and no supported way to opt out of its safety guarantees. The author says compiler optimizations can remove checks and reference-counting operations when they can be proven unnecessary.

At a glance
reportWhen: Published October 22, 2026; benchmark r…
The developmentAn Oct. 22 benchmark report found that a Roc DEFLATE compressor came within single-digit median percentages of libdeflate’s speed on two processors.

Roc’s Safety-Speed Trade-off

The result is relevant to developers weighing runtime speed against memory safety. C gives programmers direct access to unchecked memory operations, while Roc enforces memory-safety rules; the report argues that Roc nevertheless came close to a mature, hand-tuned C compressor in this specific test. That may encourage further exploration of whether safer languages can handle performance-sensitive tasks without relying on C code.

But the benchmark does not settle the broader question of whether Roc can match C generally. It tested one compression domain, two processors and one optimized Roc package. The report’s author explicitly says C retains a higher performance ceiling: for inputs where Roc currently wins, a C implementation could in principle close the gap, while Roc does not provide the same unchecked access to hardware. The result is a demonstration of proximity in one workload, not proof of equivalent performance across applications.

Amazon

Apple MacBook Pro M1 2021

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

From Lean Results to Roc

The report was prompted by an earlier account titled “Why Lean is Faster Than Rust,” which described lean-zip, a DEFLATE library written in Lean 4. That account said lean-zip outperformed Rust’s miniz_oxide at the compression levels compared, including a reported 15% speed advantage at its fastest setting alongside output 8.8% smaller. It also said lean-zip remained behind libdeflate, the C implementation used as the tougher comparison.

The author then turned to Roc, a functional language whose stated focus includes runtime and compilation speed. The report describes Roc as still weeks from its first numbered release, version 0.1.0, and says its package ecosystem had seen little optimization work. The benchmark work on roc-deflate was described as unusually extensive for a Roc package to date. The source gives no independent replication or wider survey of Roc applications, so those remain important limits on interpreting the result.

““Under 10% Slower””

— The report’s author

Amazon

AMD Ryzen 9 3900X processor

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

How Broadly the Results Apply

The findings are limited to roc-deflate’s non-streaming APIs, the Silesia corpus and the two machines named in the report. Roc’s streaming APIs had not been implemented, so they were not part of the comparison. The report does not provide independent replication, results from a wider range of workloads, or a systematic comparison across more hardware.

It also remains uncertain how much of the result comes from Roc’s compiler and language design, how much from the particular implementation and optimization effort, and whether other Roc packages can reach similar performance. The reported benchmark figures are the author’s results; they should not be read as a general performance guarantee for Roc.

Amazon

USB-C external SSD for compression benchmarks

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

More Roc Workloads Needed

The report names no scheduled follow-up benchmark or release date tied to the performance test. The clearest next step is broader measurement: optimize more real-world Roc packages, test additional hardware and workloads, and include streaming compression once roc-deflate supports it. Such results would help show whether the narrow performance gap persists outside this carefully optimized example.

Roc’s first numbered release was still described as weeks away in the report, but no exact release date was given. Until the compiler, ecosystem and benchmark coverage mature, developers considering Roc for performance-sensitive work will need to evaluate their own workloads rather than infer a general advantage from these results.

Amazon

computer programming books on functional programming and C

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Key Questions

Was Roc faster than libdeflate overall?

No. The report says roc-deflate was slower in the median comparison: 2.6% on the M1 MacBook Pro and 8.9% on the Ryzen 9 3900X. It did run faster on some individual inputs.

What did the benchmark compare?

It compared the non-streaming APIs of roc-deflate and libdeflate on the Silesia corpus. The author says the output was checked for identical results, and the tests ran on an M1 MacBook Pro and an AMD Ryzen 9 3900X running Ubuntu.

Does this show that Roc is as fast as C?

No. It shows that one optimized Roc compression package came close to one highly tuned C library in the reported tests. The report does not establish how Roc performs across other programs or workloads.

Why use Roc if libdeflate is faster on average?

The report points to Roc’s memory-safety guarantees and enforced separation of pure functions from side effects. Developers may value those properties, but the benchmark does not quantify a general safety or performance benefit across projects.

Source: hn

FALL

Fall Picks

As an affiliate, we earn on qualifying purchases.

You May Also Like

Landing Zones Explained: The Foundation Most Migrations Skip

Getting started with landing zones is crucial for a secure, organized cloud migration—discover why many overlook this vital step and how it impacts your success.

The “Cloud Center of Excellence” Explained Without the Buzzwords

Optimizing cloud use can be complex, but understanding the role of a Cloud Center of Excellence reveals how organizations can simplify and improve their cloud strategies.

Why Executive Cloud Dashboards Often Miss the Real Risk

The truth about executive cloud dashboards is they often overlook critical, hidden risks—discover how to uncover what’s really threatening your security.

Incremental – A Library For Incremental Computations

A new library called Incremental enables efficient incremental computations, promising performance gains for developers working with dynamic data.