Wasm VS Ruby benchmarks

Current benchmark data was generated on Sat Mar 29 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.)

binarytrees

Input: 18

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 5.rs 1813ms 71ms 33.1MB 1793ms 7ms wasmtime 31.0.0
wasm 3.rs 1852ms 15ms 49.3MB 1827ms 13ms wasmtime 31.0.0
wasm 4.rs 1860ms 23ms 33.3MB 1840ms 10ms wasmtime 31.0.0
ruby 1.rb 4816ms 115ms 110.0MB 4720ms 83ms ruby/yjit 3.4.2
ruby 1.rb timeout 0.0ms 70.6MB 4940ms 47ms ruby 3.4.2
ruby 1.rb timeout 0.0ms 767.2MB 6573ms 687ms truffleruby 24.2.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 5.rs 171ms 3.6ms 19.2MB 160ms 0ms wasmtime 31.0.0
wasm 4.rs 180ms 2.7ms 19.1MB 167ms 0ms wasmtime 31.0.0
wasm 3.rs 180ms 4.1ms 21.1MB 167ms 0ms wasmtime 31.0.0
ruby 1.rb 493ms 0.5ms 20.3MB 467ms 7ms ruby/yjit 3.4.2
ruby 1-m.rb 559ms 80ms 422.2MB 1103ms 163ms truffleruby 24.2.0
ruby 1.rb 937ms 4.5ms 19.6MB 913ms 10ms ruby 3.4.2

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 3.rs 1134ms 3.5ms 19.4MB 1117ms 0ms wasmtime 31.0.0
ruby 1.rb 1494ms 5.8ms 63.8MB 1420ms 60ms ruby/yjit 3.4.2
ruby 1.rb 1892ms 34ms 63.3MB 1817ms 57ms ruby 3.4.2
ruby 1.rb timeout 0.0ms 334.6MB 4650ms 1473ms truffleruby 24.2.0

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 3.rs 80ms 1.6ms 18.0MB 70ms 0ms wasmtime 31.0.0
ruby 1.rb 158ms 1.5ms 25.8MB 127ms 17ms ruby/yjit 3.4.2
ruby 1.rb 181ms 5.4ms 25.1MB 153ms 13ms ruby 3.4.2
ruby 1.rb timeout 0.0ms 366.6MB 4680ms 1503ms truffleruby 24.2.0

edigits

Input: 250001

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 417ms 2.9ms 18.6MB 403ms 0ms wasmtime 31.0.0

Input: 100000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 115ms 2.0ms 17.9MB 100ms 0ms wasmtime 31.0.0

fannkuch-redux

Input: 11

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 4164ms 21ms 16.8MB 4147ms 0ms wasmtime 31.0.0

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 348ms 2.4ms 17.4MB 337ms 0ms wasmtime 31.0.0

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 236ms 1.4ms 17.3MB 217ms 3ms wasmtime 31.0.0
ruby 6.rb 2064ms 15ms 23.0MB 2037ms 10ms ruby/yjit 3.4.2
ruby 6-m.rb 2289ms 237ms 407.7MB 5830ms 393ms truffleruby 24.2.0
ruby 6.rb 3860ms 29ms 22.5MB 3833ms 10ms ruby 3.4.2

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 32ms 0.4ms 17.6MB 20ms 0ms wasmtime 31.0.0
ruby 6.rb 267ms 1.8ms 15.0MB 247ms 7ms ruby/yjit 3.4.2
ruby 6.rb 439ms 3.5ms 14.6MB 420ms 7ms ruby 3.4.2
ruby 6-m.rb 753ms 86ms 387.0MB 1863ms 167ms truffleruby 24.2.0

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 6.7ms 0.5ms 17.2MB 0ms 0ms wasmtime 31.0.0
ruby 1.rb 36ms 0.6ms 142.1MB 12ms 30ms truffleruby 24.2.0
ruby 1.rb 53ms 1.6ms 13.0MB 38ms 2ms ruby/yjit 3.4.2
ruby 1.rb 54ms 2.2ms 12.9MB 40ms 4ms ruby 3.4.2

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 89ms 0.8ms 17.3MB 80ms 0ms wasmtime 31.0.0
ruby 1.rb 331ms 2.2ms 13.5MB 317ms 0ms ruby/yjit 3.4.2
ruby 1.rb 533ms 10ms 13.0MB 517ms 3ms ruby 3.4.2
ruby 1-m.rb 663ms 30ms 373.5MB 1203ms 143ms truffleruby 24.2.0

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 250ms 1.4ms 16.9MB 237ms 0ms wasmtime 31.0.0
ruby 1.rb 878ms 1.4ms 13.5MB 860ms 7ms ruby/yjit 3.4.2
ruby 1-m.rb 1224ms 5.7ms 410.2MB 1700ms 163ms truffleruby 24.2.0
ruby 1.rb 1482ms 9.8ms 13.0MB 1467ms 0ms ruby 3.4.2

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 48ms 1.8ms 17.4MB 40ms 0ms wasmtime 31.0.0
ruby 1.rb 194ms 3.4ms 13.5MB 173ms 3ms ruby/yjit 3.4.2
ruby 1.rb 292ms 3.1ms 12.9MB 273ms 3ms ruby 3.4.2
ruby 1-m.rb 513ms 35ms 359.3MB 960ms 140ms truffleruby 24.2.0

mandelbrot

Input: 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 8.rs 821ms 2.1ms 20.2MB 810ms 0ms wasmtime 31.0.0

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 8.rs 43ms 1.1ms 17.4MB 30ms 0ms wasmtime 31.0.0

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 927ms 58ms 41.1MB 910ms 10ms wasmtime 31.0.0
ruby 1-m.rb 4407ms 298ms 569.0MB 11110ms 383ms truffleruby 24.2.0
ruby 1.rb timeout 0.0ms 93.6MB 4933ms 53ms ruby 3.4.2
ruby 1.rb timeout 0.0ms 94.8MB 4940ms 47ms ruby/yjit 3.4.2

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 197ms 2.3ms 23.3MB 180ms 0ms wasmtime 31.0.0
ruby 1-m.rb 1990ms 144ms 479.8MB 5163ms 233ms truffleruby 24.2.0
ruby 1.rb 3411ms 25ms 38.3MB 3370ms 27ms ruby/yjit 3.4.2
ruby 1.rb 4428ms 16ms 37.8MB 4393ms 20ms ruby 3.4.2

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 411ms 2.4ms 17.1MB 400ms 0ms wasmtime 31.0.0
wasm 2.rs 583ms 2.8ms 17.0MB 570ms 0ms wasmtime 31.0.0
ruby 2.rb 824ms 13ms 322.6MB 1073ms 120ms truffleruby 24.2.0
ruby 2.rb timeout 0.0ms 12.9MB 4983ms 7ms ruby 3.4.2
ruby 2.rb timeout 0.0ms 13.5MB 4977ms 7ms ruby/yjit 3.4.2

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 49ms 0.6ms 17.0MB 40ms 0ms wasmtime 31.0.0
wasm 2.rs 66ms 1.3ms 17.2MB 53ms 0ms wasmtime 31.0.0
ruby 2-m.rb 321ms 4.1ms 314.2MB 577ms 113ms truffleruby 24.2.0
ruby 2.rb 1076ms 10ms 13.6MB 1057ms 7ms ruby/yjit 3.4.2
ruby 2.rb 2866ms 27ms 12.9MB 2847ms 3ms ruby 3.4.2

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 379ms 5.8ms 22.0MB 367ms 0ms wasmtime 31.0.0
wasm 1.rs 511ms 9.4ms 56.3MB 493ms 0ms wasmtime 31.0.0
ruby 1.rb timeout 0.0ms 325.4MB 4853ms 133ms ruby 3.4.2
ruby 1.rb timeout 0.0ms 326.9MB 4847ms 140ms ruby/yjit 3.4.2
ruby 1.rb timeout 0.0ms 695.7MB 5067ms 153ms truffleruby 24.2.0

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 96ms 2.9ms 27.1MB 83ms 0ms wasmtime 31.0.0
wasm 2.rs 98ms 0.4ms 18.3MB 90ms 0ms wasmtime 31.0.0
ruby 1-m.rb 1751ms 45ms 484.6MB 2477ms 160ms truffleruby 24.2.0
ruby 1.rb 3479ms 36ms 131.8MB 3387ms 77ms ruby/yjit 3.4.2
ruby 1.rb 4497ms 12ms 131.1MB 4407ms 77ms ruby 3.4.2

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 2218ms 13ms 18.1MB 2207ms 0ms wasmtime 31.0.0
ruby 1.rb timeout 0.0ms 46.5MB 4920ms 63ms ruby 3.4.2
ruby 1.rb timeout 0.0ms 126.8MB 4897ms 90ms ruby/yjit 3.4.2
ruby 1.rb timeout 0.0ms 456.7MB 13360ms 417ms truffleruby 24.2.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 524ms 3.2ms 17.3MB 510ms 0ms wasmtime 31.0.0
ruby 1-m.rb 1529ms 45ms 431.6MB 4037ms 210ms truffleruby 24.2.0
ruby 1.rb 1680ms 13ms 46.1MB 1637ms 30ms ruby 3.4.2
ruby 1.rb 1744ms 80ms 124.1MB 1643ms 87ms ruby/yjit 3.4.2

secp256k1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 3616ms 7.7ms 16.8MB 3603ms 0ms wasmtime 31.0.0

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 916ms 7.5ms 16.8MB 900ms 0ms wasmtime 31.0.0

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 3601ms 3.0ms 16.9MB 3587ms 0ms wasmtime 31.0.0
wasm 7.rs 4896ms 5.3ms 16.9MB 4883ms 0ms wasmtime 31.0.0
ruby 4.rb timeout 0.0ms 13.0MB 4983ms 3ms ruby 3.4.2
ruby 4.rb timeout 0.0ms 13.5MB 4983ms 3ms ruby/yjit 3.4.2
ruby 4.rb timeout 0.0ms 455.8MB 5153ms 247ms truffleruby 24.2.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 910ms 5.9ms 17.4MB 897ms 0ms wasmtime 31.0.0
wasm 7.rs 1232ms 2.6ms 17.1MB 1220ms 0ms wasmtime 31.0.0
ruby 4.rb 4895ms 35ms 451.9MB 5170ms 223ms truffleruby 24.2.0
ruby 4.rb timeout 0.0ms 12.9MB 4983ms 3ms ruby 3.4.2
ruby 4.rb timeout 0.0ms 13.5MB 4983ms 3ms ruby/yjit 3.4.2

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 236ms 2.5ms 16.7MB 223ms 0ms wasmtime 31.0.0
wasm 7.rs 315ms 1.2ms 17.2MB 300ms 0ms wasmtime 31.0.0
ruby 4.rb 1440ms 22ms 426.8MB 1757ms 150ms truffleruby 24.2.0
ruby 4.rb timeout 0.0ms 13.0MB 4983ms 3ms ruby 3.4.2
ruby 4.rb timeout 0.0ms 13.8MB 4983ms 3ms ruby/yjit 3.4.2