Wasm VS Ruby benchmarks

Current benchmark data was generated on Thu May 04 2023, full log can be found HERE

CONTRIBUTIONS are WELCOME!

[x86_64][2 cores] Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz (Model 85)

* -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 3.rs 2247ms 10ms 47.7MB 2220ms 13ms wasmedgec 0.12.0
wasm 5.rs 2270ms 20ms 31.4MB 2250ms 7ms wasmedgec 0.12.0
wasm 4.rs 2399ms 17ms 31.1MB 2377ms 7ms wasmedgec 0.12.0
wasm 5.rs 2729ms 16ms 64.3MB 2703ms 13ms node 18.16.0
wasm 5.rs 2794ms 29ms 31.5MB 2767ms 7ms wasmtime 8.0.1
wasm 3.rs 2829ms 27ms 47.5MB 2807ms 10ms wasmtime 8.0.1
wasm 4.rs 2851ms 30ms 64.2MB 2820ms 20ms node 18.16.0
wasm 3.rs 2897ms 22ms 80.3MB 2873ms 23ms node 18.16.0
wasm 4.rs 2989ms 34ms 31.5MB 2963ms 10ms wasmtime 8.0.1
ruby 1.rb timeout 0.0ms 72.7MB 4957ms 27ms ruby 3.2.2
ruby 1.rb timeout 0.0ms 82.1MB 4917ms 63ms ruby/yjit 3.2.2
ruby 1.rb timeout 0.0ms 493.5MB 8423ms 347ms truffleruby 22.3.1

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 3.rs 211ms 4.7ms 19.6MB 193ms 0ms wasmedgec 0.12.0
wasm 5.rs 213ms 2.7ms 17.4MB 197ms 0ms wasmedgec 0.12.0
wasm 4.rs 228ms 2.4ms 17.5MB 210ms 0ms wasmedgec 0.12.0
wasm 5.rs 273ms 5.7ms 17.3MB 260ms 0ms wasmtime 8.0.1
wasm 3.rs 280ms 21ms 19.4MB 247ms 3ms wasmtime 8.0.1
wasm 4.rs 288ms 8.4ms 17.3MB 267ms 0ms wasmtime 8.0.1
wasm 5.rs 302ms 0.8ms 51.2MB 287ms 10ms node 18.16.0
wasm 4.rs 312ms 5.2ms 51.6MB 293ms 17ms node 18.16.0
wasm 3.rs 314ms 2.5ms 51.9MB 300ms 10ms node 18.16.0
ruby 1.rb 625ms 33ms 40.7MB 590ms 20ms ruby/yjit 3.2.2
ruby 1.rb 1054ms 21ms 40.2MB 1020ms 17ms ruby 3.2.2
ruby 1-m.rb 1308ms 42ms 429.5MB 2093ms 207ms truffleruby 22.3.1

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 3.rs 1479ms 33ms 57.3MB 1477ms 23ms node 18.16.0
wasm 3.rs 1566ms 54ms 18.1MB 1537ms 0ms wasmtime 8.0.1
wasm 3.rs 2041ms 2.4ms 17.9MB 2023ms 0ms wasmedgec 0.12.0
ruby 1.rb 4132ms 285ms 82.8MB 4050ms 63ms ruby/yjit 3.2.2
ruby 1.rb 4480ms 204ms 82.2MB 4407ms 53ms ruby 3.2.2
ruby 1.rb timeout 0.0ms 836.9MB 4197ms 1300ms truffleruby 22.3.1

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 3.rs 105ms 1.9ms 16.3MB 90ms 0ms wasmtime 8.0.1
wasm 3.rs 139ms 1.4ms 16.1MB 127ms 0ms wasmedgec 0.12.0
wasm 3.rs 188ms 16ms 56.8MB 160ms 23ms node 18.16.0
ruby 1.rb 265ms 7.2ms 45.0MB 227ms 23ms ruby/yjit 3.2.2
ruby 1.rb 284ms 10ms 44.5MB 240ms 27ms ruby 3.2.2
ruby 1.rb timeout 0.0ms 958.8MB 3693ms 1443ms truffleruby 22.3.1

edigits

Input: 250001

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 462ms 1.8ms 16.9MB 443ms 0ms wasmedgec 0.12.0
wasm 1.rs 595ms 0.2ms 57.2MB 630ms 7ms node 18.16.0
wasm 1.rs 649ms 22ms 17.0MB 630ms 3ms wasmtime 8.0.1

Input: 100000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 125ms 1.5ms 16.4MB 117ms 0ms wasmedgec 0.12.0
wasm 1.rs 169ms 2.1ms 16.3MB 160ms 0ms wasmtime 8.0.1
wasm 1.rs 222ms 2.0ms 56.7MB 237ms 20ms node 18.16.0

fannkuch-redux

Input: 11

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs timeout 0.0ms 49.3MB 4973ms 13ms node 18.16.0
wasm 1.rs timeout 0.0ms 15.4MB 4983ms 0ms wasmedgec 0.12.0
wasm 1.rs timeout 0.0ms 15.6MB 4983ms 0ms wasmtime 8.0.1

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 448ms 9.2ms 15.6MB 430ms 0ms wasmtime 8.0.1
wasm 1.rs 515ms 3.5ms 16.0MB 500ms 0ms wasmedgec 0.12.0
wasm 1.rs 796ms 4.0ms 48.9MB 780ms 10ms node 18.16.0

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 294ms 0.9ms 15.6MB 277ms 0ms wasmedgec 0.12.0
wasm 1.rs 457ms 0.5ms 49.5MB 440ms 10ms node 18.16.0
wasm 1.rs 466ms 7.4ms 15.4MB 450ms 0ms wasmtime 8.0.1
ruby 6.rb 2402ms 31ms 43.5MB 2360ms 23ms ruby/yjit 3.2.2
ruby 6-m.rb 3067ms 177ms 363.7MB 5537ms 270ms truffleruby 22.3.1
ruby 6.rb 4221ms 19ms 43.1MB 4183ms 20ms ruby 3.2.2

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 38ms 1.0ms 15.6MB 27ms 0ms wasmedgec 0.12.0
wasm 1.rs 57ms 4.5ms 15.6MB 47ms 0ms wasmtime 8.0.1
wasm 1.rs 94ms 3.1ms 49.2MB 77ms 3ms node 18.16.0
ruby 6.rb 317ms 2.2ms 35.0MB 287ms 13ms ruby/yjit 3.2.2
ruby 6.rb 492ms 0.7ms 34.5MB 467ms 10ms ruby 3.2.2
ruby 6-m.rb 960ms 14ms 318.2MB 1630ms 130ms truffleruby 22.3.1

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 6.7ms 0.8ms 15.5MB 0ms 0ms wasmedgec 0.12.0
wasm 1.rs 9.7ms 1.3ms 15.7MB 0ms 0ms wasmtime 8.0.1
wasm 1.rs 50ms 1.9ms 47.3MB 32ms 8ms node 18.16.0
ruby 1.rb 57ms 5.5ms 157.3MB 30ms 34ms truffleruby 22.3.1
ruby 1.rb 75ms 0.9ms 32.1MB 44ms 18ms ruby 3.2.2
ruby 1.rb 81ms 4.0ms 32.2MB 50ms 16ms ruby/yjit 3.2.2

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 160ms 2.1ms 15.6MB 147ms 0ms wasmedgec 0.12.0
wasm 1.rs 192ms 6.2ms 15.8MB 177ms 0ms wasmtime 8.0.1
wasm 1.rs 269ms 3.7ms 53.8MB 260ms 7ms node 18.16.0
ruby 1.rb 473ms 15ms 32.9MB 450ms 7ms ruby/yjit 3.2.2
ruby 1.rb 658ms 7.7ms 32.4MB 633ms 7ms ruby 3.2.2
ruby 1-m.rb 985ms 50ms 320.7MB 1427ms 120ms truffleruby 22.3.1

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 459ms 1.8ms 15.2MB 440ms 0ms wasmedgec 0.12.0
wasm 1.rs 554ms 14ms 15.7MB 537ms 0ms wasmtime 8.0.1
wasm 1.rs 690ms 3.5ms 53.3MB 677ms 13ms node 18.16.0
ruby 1.rb 1241ms 4.1ms 32.9MB 1213ms 17ms ruby/yjit 3.2.2
ruby 1.rb 1814ms 14ms 32.4MB 1790ms 10ms ruby 3.2.2
ruby 1.rb 1843ms 9.4ms 374.4MB 2410ms 177ms truffleruby 22.3.1

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 82ms 0.5ms 15.4MB 70ms 0ms wasmedgec 0.12.0
wasm 1.rs 101ms 2.7ms 15.6MB 87ms 0ms wasmtime 8.0.1
wasm 1.rs 157ms 1.4ms 51.3MB 150ms 7ms node 18.16.0
ruby 1.rb 272ms 2.5ms 32.8MB 243ms 13ms ruby/yjit 3.2.2
ruby 1.rb 363ms 3.1ms 32.3MB 333ms 17ms ruby 3.2.2
ruby 1-m.rb 721ms 29ms 322.6MB 1060ms 123ms truffleruby 22.3.1

mandelbrot

Input: 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 8.rs 1069ms 7.8ms 18.5MB 1053ms 0ms wasmedgec 0.12.0
wasm 8.rs 1367ms 4.8ms 18.7MB 1353ms 0ms wasmtime 8.0.1
wasm 8.rs 1560ms 40ms 52.6MB 1547ms 7ms node 18.16.0

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 8.rs 53ms 0.1ms 15.5MB 40ms 0ms wasmedgec 0.12.0
wasm 8.rs 69ms 3.4ms 15.4MB 53ms 0ms wasmtime 8.0.1
wasm 8.rs 114ms 1.6ms 50.3MB 103ms 3ms node 18.16.0

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 1138ms 5.0ms 39.6MB 1117ms 10ms wasmedgec 0.12.0
wasm 1.rs 1361ms 19ms 39.6MB 1330ms 17ms wasmtime 8.0.1
wasm 1.rs 1379ms 6.0ms 73.8MB 1357ms 20ms node 18.16.0
ruby 1.rb timeout 0.0ms 96.4MB 4937ms 47ms ruby 3.2.2
ruby 1.rb timeout 0.0ms 96.9MB 4920ms 60ms ruby/yjit 3.2.2
ruby 1.rb timeout 0.0ms 523.5MB 9013ms 297ms truffleruby 22.3.1

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 246ms 0.3ms 21.3MB 230ms 0ms wasmedgec 0.12.0
wasm 1.rs 289ms 3.1ms 21.6MB 270ms 3ms wasmtime 8.0.1
wasm 1.rs 341ms 1.4ms 57.2MB 323ms 7ms node 18.16.0
ruby 1-m.rb 4022ms 46ms 591.0MB 7290ms 320ms truffleruby 22.3.1
ruby 1.rb 4150ms 14ms 53.6MB 4097ms 37ms ruby/yjit 3.2.2
ruby 1.rb 4968ms 17ms 52.8MB 4920ms 30ms ruby 3.2.2

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 581ms 0.6ms 17.4MB 567ms 0ms wasmedgec 0.12.0
wasm 1.rs 589ms 12ms 15.5MB 570ms 0ms wasmtime 8.0.1
wasm 1.rs 779ms 2.9ms 48.9MB 763ms 10ms node 18.16.0
wasm 2.rs 810ms 1.0ms 15.9MB 793ms 0ms wasmedgec 0.12.0
wasm 2.rs 857ms 32ms 15.6MB 840ms 0ms wasmtime 8.0.1
wasm 2.rs 1099ms 9.1ms 50.0MB 1083ms 7ms node 18.16.0
ruby 2.rb 1283ms 37ms 320.7MB 1533ms 127ms truffleruby 22.3.1
ruby 2.rb timeout 0.0ms 32.1MB 4970ms 17ms ruby 3.2.2
ruby 2.rb timeout 0.0ms 32.9MB 4957ms 23ms ruby/yjit 3.2.2

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 66ms 1.8ms 15.8MB 50ms 0ms wasmedgec 0.12.0
wasm 1.rs 70ms 3.0ms 15.6MB 60ms 0ms wasmtime 8.0.1
wasm 2.rs 89ms 1.0ms 15.7MB 80ms 0ms wasmedgec 0.12.0
wasm 2.rs 102ms 8.0ms 15.6MB 87ms 0ms wasmtime 8.0.1
wasm 1.rs 131ms 6.2ms 47.7MB 113ms 10ms node 18.16.0
wasm 2.rs 159ms 3.3ms 50.1MB 137ms 13ms node 18.16.0
ruby 2-m.rb 457ms 19ms 301.8MB 693ms 93ms truffleruby 22.3.1
ruby 2.rb 2111ms 10ms 32.9MB 2067ms 23ms ruby/yjit 3.2.2
ruby 2.rb 3201ms 26ms 32.2MB 3180ms 7ms ruby 3.2.2

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 583ms 2.3ms 20.4MB 570ms 0ms wasmedgec 0.12.0
wasm 2.rs 820ms 0.7ms 20.5MB 807ms 0ms wasmtime 8.0.1
wasm 1.rs 1189ms 31ms 54.6MB 1160ms 13ms wasmedgec 0.12.0
wasm 2.rs 1312ms 3.0ms 53.5MB 1297ms 3ms node 18.16.0
wasm 1.rs 2056ms 38ms 54.7MB 2037ms 10ms wasmtime 8.0.1
wasm 1.rs 2179ms 47ms 88.3MB 2147ms 27ms node 18.16.0
ruby 1.rb timeout 0.0ms 344.6MB 4830ms 147ms ruby 3.2.2
ruby 1.rb timeout 0.0ms 345.2MB 4813ms 163ms ruby/yjit 3.2.2
ruby 1.rb timeout 0.0ms 684.3MB 4993ms 237ms truffleruby 22.3.1

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 135ms 1.5ms 18.6MB 120ms 0ms wasmedgec 0.12.0
wasm 1.rs 152ms 1.4ms 25.4MB 140ms 0ms wasmedgec 0.12.0
wasm 1.rs 203ms 7.7ms 25.5MB 183ms 0ms wasmtime 8.0.1
wasm 2.rs 210ms 9.7ms 16.7MB 197ms 0ms wasmtime 8.0.1
wasm 2.rs 352ms 3.1ms 50.4MB 337ms 0ms node 18.16.0
wasm 1.rs 372ms 3.4ms 58.4MB 347ms 13ms node 18.16.0
ruby 1.rb 3763ms 62ms 428.9MB 4377ms 187ms truffleruby 22.3.1
ruby 1.rb timeout 0.0ms 150.9MB 4913ms 70ms ruby 3.2.2
ruby 1.rb timeout 0.0ms 151.4MB 4907ms 70ms ruby/yjit 3.2.2

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 2446ms 4.6ms 16.4MB 2430ms 0ms wasmedgec 0.12.0
wasm 2.rs 2981ms 0.3ms 54.0MB 2987ms 10ms node 18.16.0
wasm 2.rs 3340ms 0.9ms 16.7MB 3323ms 0ms wasmtime 8.0.1
ruby 1.rb timeout 0.0ms 160.6MB 4903ms 73ms ruby 3.2.2
ruby 1.rb timeout 0.0ms 159.8MB 4903ms 77ms ruby/yjit 3.2.2
ruby 1.rb timeout 0.0ms 435.3MB 9337ms 253ms truffleruby 22.3.1

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 584ms 5.6ms 16.3MB 573ms 0ms wasmedgec 0.12.0
wasm 2.rs 755ms 3.9ms 54.2MB 760ms 10ms node 18.16.0
wasm 2.rs 790ms 1.4ms 16.3MB 773ms 0ms wasmtime 8.0.1
ruby 1-m.rb 2292ms 19ms 433.2MB 4103ms 230ms truffleruby 22.3.1
ruby 1.rb 3184ms 12ms 160.5MB 3113ms 50ms ruby 3.2.2
ruby 1.rb 3217ms 26ms 160.1MB 3120ms 80ms ruby/yjit 3.2.2

secp256k1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 4154ms 3.8ms 15.7MB 4140ms 0ms wasmedgec 0.12.0
wasm 1.rs 4399ms 20ms 59.5MB 4443ms 13ms node 18.16.0
wasm 1.rs 4925ms 25ms 15.7MB 4907ms 0ms wasmtime 8.0.1

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 1045ms 1.8ms 15.9MB 1027ms 0ms wasmedgec 0.12.0
wasm 1.rs 1166ms 7.7ms 61.2MB 1203ms 17ms node 18.16.0
wasm 1.rs 1238ms 5.4ms 15.6MB 1220ms 3ms wasmtime 8.0.1

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 3441ms 0.7ms 16.1MB 3420ms 0ms wasmedgec 0.12.0
wasm 7.rs 3667ms 21ms 16.2MB 3650ms 0ms wasmedgec 0.12.0
wasm 2.rs 3814ms 3.2ms 15.5MB 3797ms 0ms wasmtime 8.0.1
wasm 7.rs 4365ms 35ms 48.9MB 4347ms 7ms node 18.16.0
wasm 2.rs 4483ms 1.7ms 48.8MB 4463ms 7ms node 18.16.0
ruby 4.rb timeout 0.0ms 32.1MB 4973ms 10ms ruby 3.2.2
ruby 4.rb timeout 0.0ms 32.7MB 4967ms 13ms ruby/yjit 3.2.2
ruby 4.rb timeout 0.0ms 362.6MB 5230ms 183ms truffleruby 22.3.1
wasm 7.rs timeout 0.0ms 15.6MB 4980ms 0ms wasmtime 8.0.1

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 868ms 0.6ms 16.1MB 850ms 0ms wasmedgec 0.12.0
wasm 7.rs 918ms 0.3ms 16.0MB 903ms 0ms wasmedgec 0.12.0
wasm 2.rs 1018ms 0.2ms 15.6MB 1000ms 0ms wasmtime 8.0.1
wasm 7.rs 1138ms 2.2ms 48.9MB 1123ms 7ms node 18.16.0
wasm 2.rs 1158ms 0.9ms 48.5MB 1140ms 7ms node 18.16.0
wasm 7.rs 3224ms 1.1ms 15.6MB 3213ms 0ms wasmtime 8.0.1
ruby 4.rb timeout 0.0ms 32.1MB 4970ms 13ms ruby 3.2.2
ruby 4.rb timeout 0.0ms 32.7MB 4970ms 10ms ruby/yjit 3.2.2
ruby 4.rb timeout 0.0ms 432.3MB 5530ms 197ms truffleruby 22.3.1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 224ms 0.8ms 15.8MB 213ms 0ms wasmedgec 0.12.0
wasm 7.rs 239ms 4.3ms 15.8MB 220ms 0ms wasmedgec 0.12.0
wasm 2.rs 263ms 1.6ms 15.5MB 247ms 0ms wasmtime 8.0.1
wasm 7.rs 323ms 2.1ms 47.7MB 307ms 3ms node 18.16.0
wasm 2.rs 329ms 0.3ms 48.6MB 310ms 3ms node 18.16.0
wasm 7.rs 816ms 3.0ms 15.6MB 800ms 0ms wasmtime 8.0.1
ruby 4.rb 3234ms 30ms 410.8MB 3887ms 177ms truffleruby 22.3.1
ruby 4.rb timeout 0.0ms 32.4MB 4967ms 13ms ruby 3.2.2
ruby 4.rb timeout 0.0ms 32.7MB 4960ms 17ms ruby/yjit 3.2.2