Rust VS Haxe benchmarks

Current benchmark data was generated on Mon Apr 14 2025, full log can be found HERE

CONTRIBUTIONS are WELCOME!

[x86_64][4 cores] AMD EPYC 7763 64-Core Processor (Model 1)

* -m in a file name stands for multi-threading or multi-processing

* -i in a file name stands for direct intrinsics usage. (Usage of simd intrinsics via libraries is not counted)

* -ffi in a file name stands for non-stdlib FFI usage

* (You may find time < time(user) + time(sys) for some non-parallelized programs, the overhead is from GC or JIT compiler, which are allowed to take advantage of multi-cores as that's more close to real-world scenarios.)

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 1.rs 1.2ms 0.1ms 1.9MB 0ms 0ms rustc 1.86.0
rust 1.rs 1.2ms 0.1ms 1.8MB 0ms 0ms rustc 1.88.0-nightly
haxe 1.hx 2.0ms 0.2ms 2.9MB 0ms 0ms haxe/hl/c 4.3.6
haxe 1.hx 2.3ms 0.3ms 4.4MB 0ms 0ms haxe/cpp 4.3.6
haxe 1.hx 3.8ms 0.4ms 2.9MB 0ms 0ms haxe/hl/jit 1.15.0

mandelbrot

Input: 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 9.rs 275ms 0.4ms 4.8MB 267ms 0ms rustc 1.88.0-nightly
rust 8.rs 293ms 2.0ms 4.8MB 283ms 0ms rustc 1.86.0

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 9.rs 13ms 0.5ms 1.9MB 10ms 0ms rustc 1.88.0-nightly
rust 8.rs 14ms 0.2ms 1.9MB 10ms 0ms rustc 1.86.0

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 4-i.rs 163ms 0.5ms 1.8MB 160ms 0ms rustc 1.86.0
rust 7-i.rs 237ms 0.9ms 1.8MB 230ms 0ms rustc 1.86.0
rust 1.rs 240ms 0.4ms 1.8MB 230ms 0ms rustc 1.86.0
rust 3.rs 279ms 0.7ms 1.9MB 270ms 0ms rustc 1.88.0-nightly
rust 2.rs 284ms 0.8ms 1.8MB 273ms 0ms rustc 1.86.0
haxe 2.hx 859ms 10ms 3.1MB 847ms 0ms haxe/hl/c 4.3.6
haxe 1.hx 1069ms 3.8ms 3.0MB 1060ms 0ms haxe/hl/c 4.3.6
haxe 3.hx 1399ms 33ms 25.6MB 1583ms 37ms haxe/cpp 4.3.6
haxe 2.hx 2410ms 0.9ms 3.8MB 2400ms 0ms haxe/hl/jit 1.15.0
haxe 1.hx 2465ms 6.6ms 3.6MB 2453ms 0ms haxe/hl/jit 1.15.0
haxe 1.hx timeout 0.0ms 4.4MB 4990ms 0ms haxe/cpp 4.3.6
haxe 2.hx timeout 0.0ms 4.4MB 4990ms 0ms haxe/cpp 4.3.6
haxe 3.hx timeout 0.0ms 3.2MB 3880ms 1640ms haxe/hl/c 4.3.6
haxe 3.hx timeout 0.0ms 4.1MB 4237ms 1250ms haxe/hl/jit 1.15.0

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 4-i.rs 18ms 0.1ms 1.8MB 10ms 0ms rustc 1.86.0
rust 7-i.rs 26ms 0.5ms 1.9MB 20ms 0ms rustc 1.86.0
rust 1.rs 26ms 0.2ms 1.8MB 20ms 0ms rustc 1.86.0
rust 3.rs 30ms 0.1ms 1.8MB 20ms 0ms rustc 1.88.0-nightly
rust 2.rs 31ms 0.2ms 1.8MB 20ms 0ms rustc 1.86.0
haxe 2.hx 90ms 1.9ms 3.0MB 80ms 0ms haxe/hl/c 4.3.6
haxe 1.hx 114ms 2.1ms 3.0MB 107ms 0ms haxe/hl/c 4.3.6
haxe 3.hx 157ms 3.4ms 25.8MB 153ms 10ms haxe/cpp 4.3.6
haxe 2.hx 248ms 2.3ms 3.6MB 237ms 0ms haxe/hl/jit 1.15.0
haxe 1.hx 253ms 1.2ms 3.8MB 240ms 0ms haxe/hl/jit 1.15.0
haxe 3.hx 670ms 1.6ms 3.2MB 527ms 200ms haxe/hl/c 4.3.6
haxe 2.hx 674ms 5.7ms 4.4MB 663ms 0ms haxe/cpp 4.3.6
haxe 3.hx 790ms 5.6ms 3.8MB 653ms 200ms haxe/hl/jit 1.15.0
haxe 1.hx 812ms 9.3ms 4.4MB 803ms 0ms haxe/cpp 4.3.6

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 8-m.rs 494ms 0.6ms 2.4MB 1910ms 3ms rustc 1.88.0-nightly
rust 7-m.rs 501ms 0.5ms 2.3MB 1937ms 3ms rustc 1.86.0
rust 8.rs 993ms 1.6ms 2.4MB 980ms 0ms rustc 1.88.0-nightly
rust 2-m.rs 1965ms 1.7ms 2.4MB 7730ms 7ms rustc 1.86.0
rust 7.rs 2063ms 2.7ms 2.0MB 2053ms 0ms rustc 1.86.0
haxe 1.hx 3955ms 12ms 3.3MB 3947ms 0ms haxe/hl/c 4.3.6
rust 2.rs 4219ms 3.4ms 2.1MB 4207ms 0ms rustc 1.86.0
haxe 1.hx timeout 0.0ms 6.9MB 4990ms 0ms haxe/cpp 4.3.6
haxe 1.hx timeout 0.0ms 3.7MB 4990ms 0ms haxe/hl/jit 1.15.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 8-m.rs 128ms 0.1ms 2.4MB 463ms 0ms rustc 1.88.0-nightly
rust 7-m.rs 130ms 0.6ms 2.3MB 473ms 0ms rustc 1.86.0
rust 8.rs 251ms 1.0ms 2.3MB 240ms 0ms rustc 1.88.0-nightly
rust 2-m.rs 495ms 0.3ms 2.1MB 1910ms 7ms rustc 1.86.0
rust 7.rs 521ms 1.8ms 1.8MB 510ms 0ms rustc 1.86.0
haxe 1.hx 1001ms 3.8ms 3.1MB 983ms 0ms haxe/hl/c 4.3.6
rust 2.rs 1059ms 1.2ms 1.9MB 1050ms 0ms rustc 1.86.0
haxe 1.hx 2398ms 1.4ms 6.6MB 2387ms 0ms haxe/cpp 4.3.6
haxe 1.hx timeout 0.0ms 3.9MB 4987ms 0ms haxe/hl/jit 1.15.0

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 8-m.rs 35ms 0.4ms 2.1MB 110ms 0ms rustc 1.88.0-nightly
rust 7-m.rs 36ms 0.2ms 2.1MB 107ms 3ms rustc 1.86.0
rust 8.rs 65ms 1.0ms 2.0MB 57ms 0ms rustc 1.88.0-nightly
rust 2-m.rs 128ms 0.5ms 2.1MB 470ms 0ms rustc 1.86.0
rust 7.rs 133ms 2.1ms 1.9MB 127ms 0ms rustc 1.86.0
haxe 1.hx 257ms 1.4ms 3.0MB 250ms 0ms haxe/hl/c 4.3.6
rust 2.rs 267ms 1.3ms 1.9MB 257ms 0ms rustc 1.86.0
haxe 1.hx 603ms 0.6ms 5.4MB 590ms 0ms haxe/cpp 4.3.6
haxe 1.hx 2229ms 148ms 3.6MB 2217ms 0ms haxe/hl/jit 1.15.0

binarytrees

Input: 18

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 4.rs 1281ms 5.2ms 33.6MB 1260ms 7ms rustc 1.86.0
haxe 1.hx 1342ms 4.5ms 144.0MB 1543ms 60ms haxe/cpp 4.3.6
rust 5.rs 1344ms 1.4ms 33.8MB 1317ms 10ms rustc 1.86.0
rust 3.rs 1480ms 48ms 49.8MB 1450ms 13ms rustc 1.86.0
haxe 2.hx 4432ms 13ms 495.1MB 5033ms 240ms haxe/cpp 4.3.6
haxe 1.hx timeout 0.0ms 48.7MB 5777ms 390ms haxe/hl/c 4.3.6
haxe 2.hx timeout 0.0ms 83.0MB 5190ms 670ms haxe/hl/c 4.3.6
haxe 1.hx timeout 0.0ms 50.3MB 7990ms 417ms haxe/hl/jit 1.15.0
haxe 2.hx timeout 0.0ms 130.8MB 7553ms 747ms haxe/hl/jit 1.15.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 94ms 2.8ms 25.6MB 87ms 10ms haxe/cpp 4.3.6
rust 4.rs 123ms 2.7ms 5.6MB 117ms 0ms rustc 1.86.0
rust 5.rs 127ms 1.9ms 5.8MB 120ms 0ms rustc 1.86.0
rust 3.rs 143ms 9.2ms 7.8MB 130ms 0ms rustc 1.86.0
haxe 2.hx 400ms 3.2ms 58.3MB 433ms 27ms haxe/cpp 4.3.6
haxe 1.hx 686ms 9.9ms 8.8MB 653ms 50ms haxe/hl/c 4.3.6
haxe 1.hx 718ms 17ms 11.2MB 797ms 63ms haxe/hl/jit 1.15.0
haxe 2.hx 1232ms 144ms 13.7MB 1113ms 163ms haxe/hl/c 4.3.6
haxe 2.hx 1251ms 52ms 25.2MB 1313ms 177ms haxe/hl/jit 1.15.0

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 3-m.rs 550ms 46ms 9.1MB 2070ms 70ms rustc 1.86.0
rust 5-m.rs 667ms 6.9ms 5.6MB 2517ms 67ms rustc 1.86.0
rust 1-m.rs 937ms 11ms 8.5MB 3437ms 210ms rustc 1.86.0
rust 3.rs 1112ms 2.4ms 9.3MB 1070ms 30ms rustc 1.86.0
rust 4.rs 1884ms 5.6ms 7.4MB 1867ms 0ms rustc 1.86.0

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 5-m.rs 53ms 2.0ms 3.4MB 157ms 13ms rustc 1.86.0
rust 3-m.rs 57ms 2.2ms 4.3MB 180ms 10ms rustc 1.86.0
rust 3.rs 71ms 2.9ms 4.0MB 60ms 0ms rustc 1.86.0
rust 1-m.rs 72ms 0.7ms 3.8MB 227ms 23ms rustc 1.86.0
rust 4.rs 115ms 0.3ms 3.3MB 107ms 0ms rustc 1.86.0

edigits

Input: 250001

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 1.rs 119ms 2.2ms 3.6MB 110ms 0ms rustc 1.86.0
rust 2.rs 424ms 1.6ms 3.6MB 413ms 0ms rustc 1.86.0

Input: 100000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 1.rs 33ms 0.4ms 2.9MB 23ms 0ms rustc 1.86.0
rust 2.rs 76ms 0.5ms 3.0MB 70ms 0ms rustc 1.86.0

fannkuch-redux

Input: 11

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 3-im.rs 410ms 0.5ms 2.0MB 1573ms 0ms rustc 1.86.0
rust 5-m.rs 579ms 12ms 2.1MB 2190ms 0ms rustc 1.86.0
rust 2-im.rs 627ms 5.0ms 2.1MB 2440ms 0ms rustc 1.86.0
rust 1-m.rs 970ms 5.3ms 2.1MB 3770ms 0ms rustc 1.86.0
rust 3-i.rs 1508ms 2.6ms 1.9MB 1497ms 0ms rustc 1.86.0
rust 2-i.rs 1759ms 2.8ms 1.8MB 1750ms 0ms rustc 1.86.0
rust 1.rs 2692ms 4.5ms 1.8MB 2683ms 0ms rustc 1.86.0

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 3-im.rs 38ms 0.5ms 2.1MB 120ms 0ms rustc 1.86.0
rust 5-m.rs 53ms 1.1ms 2.0MB 173ms 0ms rustc 1.86.0
rust 2-im.rs 60ms 1.3ms 2.0MB 200ms 0ms rustc 1.86.0
rust 1-m.rs 87ms 0.9ms 2.0MB 300ms 0ms rustc 1.86.0
rust 3-i.rs 127ms 0.8ms 1.9MB 120ms 0ms rustc 1.86.0
rust 2-i.rs 150ms 0.8ms 1.8MB 140ms 0ms rustc 1.86.0
rust 1.rs 229ms 0.2ms 1.9MB 220ms 0ms rustc 1.86.0

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 5c-m.rs 89ms 0.4ms 3.2MB 247ms 0ms rustc 1.86.0
rust 5-m.rs 93ms 1.6ms 3.2MB 277ms 0ms rustc 1.86.0
rust 6.rs 144ms 0.8ms 1.9MB 133ms 0ms rustc 1.86.0
rust 1c.rs 162ms 0.4ms 1.9MB 150ms 0ms rustc 1.86.0
rust 1.rs 194ms 0.5ms 2.0MB 183ms 0ms rustc 1.86.0
haxe 1.hx 2396ms 7.4ms 25.6MB 2277ms 237ms haxe/cpp 4.3.6
haxe 1.hx timeout 0.0ms 3.3MB 4340ms 873ms haxe/hl/c 4.3.6
haxe 1.hx timeout 0.0ms 3.6MB 4370ms 873ms haxe/hl/jit 1.15.0

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 5c-m.rs 16ms 0.6ms 3.2MB 20ms 0ms rustc 1.86.0
rust 5-m.rs 16ms 0.3ms 3.2MB 20ms 0ms rustc 1.86.0
rust 6.rs 17ms 0.8ms 1.9MB 10ms 0ms rustc 1.86.0
rust 1c.rs 19ms 0.2ms 1.8MB 10ms 0ms rustc 1.86.0
rust 1.rs 22ms 0.3ms 1.9MB 13ms 0ms rustc 1.86.0
haxe 1.hx 255ms 2.5ms 25.6MB 230ms 30ms haxe/cpp 4.3.6
haxe 1.hx 688ms 1.2ms 3.3MB 590ms 120ms haxe/hl/c 4.3.6
haxe 1.hx 694ms 0.4ms 3.6MB 620ms 93ms haxe/hl/jit 1.15.0

http-server

Input: 3000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 1-m.rs 306ms 70ms 84.5MB 163ms 513ms rustc 1.86.0
rust 2-m.rs 412ms 81ms 69.0MB 237ms 887ms rustc 1.86.0
rust 2-http2.rs 422ms 21ms 60.3MB 873ms 543ms rustc 1.86.0
rust 1-http2.rs 623ms 77ms 63.6MB 1497ms 697ms rustc 1.86.0

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 1-m.rs 43ms 6.4ms 17.5MB 17ms 60ms rustc 1.86.0
rust 2-m.rs 78ms 6.8ms 21.8MB 30ms 157ms rustc 1.86.0
rust 2-http2.rs 220ms 47ms 27.6MB 560ms 183ms rustc 1.86.0
rust 1-http2.rs 253ms 35ms 27.8MB 683ms 197ms rustc 1.86.0

json-serde

Input: sample 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 5-i.rs 28ms 1.1ms 9.8MB 20ms 0ms rustc 1.86.0
rust 4-i.rs 31ms 1.0ms 7.9MB 20ms 0ms rustc 1.86.0
rust 3.rs 62ms 0.9ms 32.0MB 40ms 10ms rustc 1.86.0
rust 2.rs 63ms 1.1ms 33.8MB 40ms 10ms rustc 1.86.0
rust 1.rs 100ms 1.6ms 67.4MB 63ms 23ms rustc 1.86.0

Input: canada 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 5-i.rs 209ms 2.5ms 52.6MB 183ms 13ms rustc 1.86.0
rust 4-i.rs 259ms 0.4ms 54.3MB 203ms 40ms rustc 1.86.0
rust 2.rs 409ms 4.6ms 237.6MB 307ms 90ms rustc 1.86.0
rust 3.rs 412ms 1.3ms 237.6MB 307ms 90ms rustc 1.86.0
rust 1.rs 686ms 5.4ms 550.2MB 447ms 227ms rustc 1.86.0

knucleotide

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 8-m.rs 227ms 1.7ms 26.6MB 660ms 7ms rustc 1.86.0
rust 8.rs 468ms 3.0ms 22.3MB 450ms 0ms rustc 1.86.0

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 8-m.rs 30ms 3.1ms 16.4MB 67ms 0ms rustc 1.86.0
rust 8.rs 58ms 1.1ms 11.6MB 47ms 0ms rustc 1.86.0

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 0-unsafe.rs 34ms 5.9ms 1.8MB 23ms 0ms rustc 1.86.0
rust 1.rs 57ms 5.3ms 1.9MB 47ms 0ms rustc 1.86.0
haxe 1.hx 135ms 1.6ms 20.6MB 120ms 7ms haxe/cpp 4.3.6
haxe 1.hx 138ms 2.2ms 3.1MB 130ms 0ms haxe/hl/c 4.3.6
haxe 1.hx 155ms 3.2ms 3.8MB 143ms 0ms haxe/hl/jit 1.15.0

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 0-unsafe.rs 135ms 6.2ms 1.8MB 123ms 0ms rustc 1.86.0
rust 1.rs 199ms 28ms 1.9MB 190ms 0ms rustc 1.86.0
haxe 1.hx 381ms 4.0ms 25.5MB 367ms 7ms haxe/cpp 4.3.6
haxe 1.hx 401ms 4.9ms 3.0MB 393ms 0ms haxe/hl/c 4.3.6
haxe 1.hx 460ms 6.4ms 3.8MB 447ms 0ms haxe/hl/jit 1.15.0

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 0-unsafe.rs 23ms 0.4ms 1.8MB 17ms 0ms rustc 1.86.0
rust 1.rs 30ms 2.2ms 1.8MB 23ms 0ms rustc 1.86.0
haxe 1.hx 63ms 1.0ms 12.3MB 50ms 0ms haxe/cpp 4.3.6
haxe 1.hx 67ms 1.1ms 3.0MB 60ms 0ms haxe/hl/c 4.3.6
haxe 1.hx 79ms 1.1ms 3.6MB 70ms 0ms haxe/hl/jit 1.15.0

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 1.rs 703ms 1.4ms 33.8MB 680ms 10ms rustc 1.86.0
haxe 1.hx 902ms 4.4ms 95.1MB 1003ms 43ms haxe/cpp 4.3.6
haxe 1.hx timeout 0.0ms 32.6MB 5047ms 467ms haxe/hl/c 4.3.6
haxe 1.hx timeout 0.0ms 55.1MB 6293ms 470ms haxe/hl/jit 1.15.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 1.rs 150ms 2.2ms 9.8MB 140ms 0ms rustc 1.86.0
haxe 1.hx 175ms 6.0ms 26.9MB 177ms 10ms haxe/cpp 4.3.6
haxe 1.hx 1321ms 16ms 10.8MB 1257ms 140ms haxe/hl/c 4.3.6
haxe 1.hx 1530ms 20ms 20.4MB 1577ms 137ms haxe/hl/jit 1.15.0

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 1.rs 308ms 4.4ms 40.9MB 293ms 0ms rustc 1.86.0
rust 2.rs 328ms 1.8ms 6.6MB 317ms 0ms rustc 1.86.0

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 1.rs 59ms 2.9ms 11.6MB 47ms 0ms rustc 1.86.0
rust 2.rs 83ms 1.0ms 2.9MB 70ms 0ms rustc 1.86.0

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 1.rs 1514ms 7.3ms 2.7MB 1303ms 197ms rustc 1.86.0
rust 2.rs 1711ms 4.7ms 2.7MB 1623ms 70ms rustc 1.86.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 1.rs 320ms 0.7ms 2.4MB 293ms 13ms rustc 1.86.0
rust 2.rs 387ms 2.7ms 2.4MB 377ms 0ms rustc 1.86.0

regex-redux

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 7.rs 439ms 6.7ms 77.6MB 457ms 13ms rustc 1.86.0

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 7.rs 48ms 0.7ms 12.6MB 40ms 0ms rustc 1.86.0

secp256k1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 0.rs 116ms 0.4ms 1.6MB 110ms 0ms rustc 1.86.0
rust 1.rs 1477ms 11ms 1.9MB 1470ms 0ms rustc 1.86.0

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 0.rs 31ms 0.1ms 1.8MB 20ms 0ms rustc 1.86.0
rust 1.rs 366ms 0.8ms 1.9MB 360ms 0ms rustc 1.86.0