772ms: Roc 0.1.0 runs as fast as Rust on my loop
DEV Community

772ms: Roc 0.1.0 runs as fast as Rust on my loop

Roc 0.1.0 ran my 100-million-iteration checksum loop in 772ms. The same loop in Rust (rustc -O) took 829ms and in Go 785ms - on one workload, on one machine, the "nearly as fast as Rust" claim holds to within 7%.

The build story is where it gets interesting: roc check on my file took 19-61ms, and a dev build finished in under 0.1s.

What shipped

Roc 0.1.0 landed November 30, 2026, eight years after Richard Feldman started designing the language in 2018. The tagline is "fast, friendly, functional," and the release post makes two testable claims: Roc is "designed to build faster than Go" and its programs "run nearly as fast as Rust."

The post backs the runtime claim with four community benchmarks, all measured by the project authors, not by me:

  • roc-deflate at a 2.6% median slowdown vs C's libdeflate on an M1 MacBook Pro (8.9% on a Ryzen 3900X) across 144 benchmarks
  • roc-redis at 91-96% of Rust's redis-rs throughput
  • roc-regex matching 37-98% of the Rust regex crate's time
  • roux, a Roc web framework on a Zig server, at 99-160% of Rust's axum throughput

I did not reproduce any of those. What I did was take the two headline claims and test them on my own machine with a workload I control completely.

The experiment

One loop, three languages, byte-identical logic: start with acc = 0, count n down from 100,000,000, and on each step compute acc = (acc * 31 + n) % 1,000,000,007. Integer multiply, add, modulo - no allocation, no I/O, nothing for a compiler to optimize away except the arithmetic itself.

All three programs must print the same checksum, or the comparison is meaningless.

The Roc version:

main! = |_| {
    var $acc = 0.I64
    var $n = 100_000_000.I64
    while $n > 0 {
        $acc = ($acc * 31 + $n) % 1_000_000_007
        $n = $n - 1
    }
    echo!("checksum: ${$acc.to_str()}")
    Ok({})
}

The Rust version (rustc -O) and the Go version are the same loop with i64 / int64 types. All three printed checksum: 542021695.

My machine: AMD EPYC 9D64, 4 vCPUs, in a Linux VM. Roc 0.1.0 from the official install script, Go 1.27.4, rustc 1.100.1.

Runtime: essentially tied

Median of 5 runs each, wall clock of the compiled binary:

  • Roc --opt=speed (LLVM, the default) 772 ms [769, 771, 772, 778, 813]
  • Roc --opt=dev (dev backend) 801 ms [771, 800, 822, 834, 801]
  • Go 1.27.4 785 ms [779, 781, 785, 788, 798]
  • Rust rustc -O 829 ms [824, 824, 829, 838, 840]

Roc's optimized build was the fastest of the four by a hair; its unoptimized dev build was within 4% of Rust -O. On this workload the three compilers are within 7% of each other, which is noise-level for a single loop on a shared VM.

The honest reading: Roc is in the same performance class as Rust and Go here, not ahead of them in any meaningful sense. One loop is one data point - but it is a data point the release post's claim survives, which is more than most launch-day benchmarks get.

My first version crashed, and the crash is the interesting part

My first attempt used plain integer literals:

var $acc = 0
var $n = 100_000_000

It crashed immediately with:

Integer multiplication overflowed

Two things I learned from that crash, both worth knowing before you write your first Roc program:

  • Bare integer literals default to I32 in Roc 0.1.0. My accumulator exceeds 2^31 the moment acc * 31 passes ~69 million, which happens within the first few iterations. The fix is the .I64 suffix: 0.I64. The old 0i64 suffix syntax is deprecated - the compiler tells you so, with the exact replacement.
  • Arithmetic is checked, not wrapping. There is no silent wraparound; overflow is a runtime crash with a clear message. The release post's own examples include a "Safe Math" page for exactly this reason. If you come from Rust, this is debug_assertions behavior everywhere, all the time - friendlier to debug, and something to keep in mind for hot loops.

Build times: the feedback loop is real, with one asterisk

Same 12-line file, timed with perf_counter around the compiler invocation:

  • roc check (warm cache) 19-37 ms
  • roc check (cache cleared) 61 ms
  • roc build --opt=dev 57-100 ms
  • roc build --opt=speed 435-551 ms
  • rustc -O (single file) 164-213 ms (first invocation: 1,448 ms)
  • go build (warm cache) 148-170 ms (first invocation: 1,481 ms)
  • go build (build cache cleared) 14,254 ms

(The first-invocation numbers for rustc and Go are cold page cache on this VM, not compiler speed - which is why I report the range after them.)

roc check in under 40ms warm is the fastest feedback loop of the four, and it matches the shape of the release post's own numbers - cold roc check of 249-874ms on real community projects of 4,000-66,000 lines. A dev build in ~0.1s is genuinely fast.

The asterisk is the Go cold number: 14.2 seconds. That is real - clearing Go's build cache forces it to recompile the standard library from source - but it measures something different from Roc's 0.5s. Roc ships a prebuilt standard library; Go compiles fmt from scratch on a cold cache. "Cold" is not the same word in both compilers, and the fair comparison is warm-to-warm, where Go (148-170ms) actually beats Roc's optimized build (435-551ms) and sits next to its dev build.

Roc wins the cold-cache comparison by a lot and the typecheck comparison by more; it does not win every build comparison.

One more number for the binary-size crowd: the Roc optimized binary is 23 KB (static musl link, the default target), the dev binary 617 KB, Go 2.4 MB, Rust 4.5 MB.

What I did not verify

The release post's community benchmarks - deflate, redis, regex, axum - are the authors' own measurements on their own machines, and I did not re-run them. The roux-vs-axum numbers in particular come from the roux author's nightly benchmark page.

A 12-line checksum loop tests a compiler's integer loop, not a language's real-world performance. The claim that survives my machine is the narrow one: on a tight integer loop, Roc 0.1.0 runs with Rust and Go, and its typechecker answers in tens of milliseconds.

Verdict

Eight years, one numbered release, and the two headline claims both survived contact with my machine - runtime parity on a toy workload, and a feedback loop that really is measured in milliseconds.

The thing that will decide whether Roc matters is not this loop; it is whether the 10,000-line project also checks in under a second, which is the release post's claim and the one I have not tested yet. That is the next measurement.

Sources

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.