| How close can pure functional programming get to C?(rtfeldman.com) | |
| 275 points by stmonty 1 day ago | 99 comments | |
tl;dr: Roc, a pure functional language with automatic memory management and mandatory bounds checking, achieved DEFLATE compression performance within a median 2.6-8.9% of libdeflate (a heavily SIMD-optimized C library) on the Silesia corpus, even beating it on some inputs. The author argues the small performance gap is worth it for guarantees like memory safety, pure functions, deterministic cross-target behavior, and supply-chain security (no FFI or build scripts). Key optimizations leveraged Roc-specific features like opportunistic in-place mutation, compile-time lookup tables, hoisted bounds checks, and wrapping arithmetic. | |
HN Discussion:
| |