Wasm VS Nim benchmarks

Current benchmark data was generated on Tue Apr 01 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
nim 2.nim 911ms 3.9ms 34.6MB 893ms 0ms nim 2.2.2
nim 2.nim 1032ms 45ms 34.9MB 1017ms 0ms nim/clang 2.2.2
wasm 5.rs 1809ms 60ms 33.1MB 1790ms 7ms wasmtime 31.0.0
wasm 3.rs 1854ms 16ms 49.2MB 1827ms 17ms wasmtime 31.0.0
wasm 4.rs 1863ms 11ms 33.2MB 1840ms 10ms wasmtime 31.0.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 2.nim 88ms 2.3ms 5.5MB 80ms 0ms nim 2.2.2
nim 2.nim 93ms 2.6ms 5.8MB 80ms 0ms nim/clang 2.2.2
wasm 5.rs 174ms 4.1ms 19.3MB 157ms 0ms wasmtime 31.0.0
wasm 3.rs 180ms 2.4ms 21.1MB 163ms 0ms wasmtime 31.0.0
wasm 4.rs 181ms 4.0ms 19.2MB 163ms 0ms wasmtime 31.0.0

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 3.rs 1133ms 6.8ms 19.4MB 1117ms 0ms wasmtime 31.0.0
nim 1.nim timeout 0.0ms 551.4MB 2497ms 2040ms nim 2.2.2
nim 1.nim timeout 0.0ms 559.8MB 2490ms 2047ms nim/clang 2.2.2

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 3.rs 82ms 1.6ms 17.7MB 70ms 0ms wasmtime 31.0.0
nim 1.nim 4356ms 55ms 519.8MB 2120ms 1803ms nim/clang 2.2.2
nim 1.nim 4452ms 76ms 519.4MB 2183ms 1837ms nim 2.2.2

edigits

Input: 250001

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 421ms 7.8ms 18.6MB 403ms 3ms 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.6ms 18.0MB 103ms 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 4154ms 12ms 16.7MB 4137ms 0ms wasmtime 31.0.0

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 353ms 4.0ms 17.2MB 340ms 0ms wasmtime 31.0.0

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 2.nim 187ms 0.9ms 1.5MB 177ms 0ms nim 2.2.2
wasm 1.rs 237ms 2.6ms 17.5MB 223ms 3ms wasmtime 31.0.0
nim 2.nim 238ms 0.7ms 1.8MB 227ms 0ms nim/clang 2.2.2
nim 1.nim 556ms 1.1ms 1.8MB 447ms 93ms nim/clang 2.2.2
nim 1.nim 579ms 0.3ms 1.5MB 467ms 97ms nim 2.2.2

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 2.nim 22ms 0.4ms 1.5MB 13ms 0ms nim 2.2.2
nim 2.nim 26ms 0.4ms 1.8MB 20ms 0ms nim/clang 2.2.2
wasm 1.rs 32ms 0.9ms 17.3MB 20ms 0ms wasmtime 31.0.0
nim 1.nim 58ms 0.2ms 1.8MB 40ms 7ms nim/clang 2.2.2
nim 1.nim 62ms 1.0ms 1.5MB 43ms 7ms nim 2.2.2

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 1.nim 1.0ms 0.1ms 1.6MB 0ms 0ms nim 2.2.2
nim 1.nim 1.2ms 0.0ms 1.9MB 0ms 0ms nim/clang 2.2.2
wasm 1.rs 7.3ms 1.3ms 17.4MB 0ms 0ms wasmtime 31.0.0

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 90ms 0.5ms 17.4MB 80ms 0ms wasmtime 31.0.0
nim 2.nim 111ms 1.8ms 1.4MB 103ms 0ms nim 2.2.2
nim 2.nim 112ms 0.9ms 1.6MB 100ms 0ms nim/clang 2.2.2
nim 1.nim timeout 0.0ms 1.3MB 4990ms 0ms nim 2.2.2
nim 1.nim timeout 0.0ms 1.5MB 4990ms 0ms nim/clang 2.2.2

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 255ms 5.4ms 16.9MB 240ms 0ms wasmtime 31.0.0
nim 2.nim 328ms 2.7ms 1.6MB 317ms 0ms nim/clang 2.2.2
nim 2.nim 331ms 1.6ms 1.4MB 320ms 0ms nim 2.2.2
nim 1.nim timeout 0.0ms 1.3MB 4990ms 0ms nim 2.2.2
nim 1.nim timeout 0.0ms 1.5MB 4990ms 0ms nim/clang 2.2.2

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 48ms 1.5ms 17.4MB 37ms 0ms wasmtime 31.0.0
nim 2.nim 49ms 0.9ms 1.6MB 40ms 0ms nim/clang 2.2.2
nim 2.nim 50ms 0.3ms 1.3MB 40ms 0ms nim 2.2.2
nim 1.nim 442ms 4.2ms 1.8MB 433ms 0ms nim/clang 2.2.2
nim 1.nim 486ms 4.9ms 1.3MB 477ms 0ms nim 2.2.2

mandelbrot

Input: 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 1.nim 389ms 0.8ms 4.7MB 380ms 0ms nim/clang 2.2.2
nim 1.nim 578ms 2.6ms 4.4MB 570ms 0ms nim 2.2.2
wasm 8.rs 832ms 8.8ms 20.3MB 817ms 0ms wasmtime 31.0.0

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 1.nim 19ms 0.2ms 1.9MB 10ms 0ms nim/clang 2.2.2
nim 1.nim 29ms 2.3ms 1.6MB 20ms 0ms nim 2.2.2
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
nim 1.nim 526ms 2.3ms 34.6MB 510ms 3ms nim 2.2.2
nim 1.nim 651ms 20ms 35.0MB 633ms 3ms nim/clang 2.2.2
wasm 1.rs 939ms 69ms 41.1MB 913ms 13ms wasmtime 31.0.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 1.nim 115ms 1.7ms 9.6MB 103ms 0ms nim 2.2.2
nim 1.nim 135ms 1.5ms 9.9MB 120ms 0ms nim/clang 2.2.2
wasm 1.rs 201ms 2.9ms 23.2MB 183ms 0ms wasmtime 31.0.0

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 2.nim 321ms 1.3ms 1.8MB 310ms 0ms nim 2.2.2
nim 2.nim 342ms 1.8ms 2.0MB 333ms 0ms nim/clang 2.2.2
wasm 1.rs 413ms 2.3ms 17.1MB 400ms 0ms wasmtime 31.0.0
wasm 2.rs 587ms 3.1ms 17.0MB 573ms 0ms wasmtime 31.0.0

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 2.nim 34ms 0.6ms 1.8MB 30ms 0ms nim 2.2.2
nim 2.nim 38ms 0.7ms 2.0MB 30ms 0ms nim/clang 2.2.2
wasm 1.rs 50ms 1.6ms 17.1MB 37ms 0ms wasmtime 31.0.0
wasm 2.rs 67ms 0.7ms 17.4MB 53ms 0ms wasmtime 31.0.0

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 1.nim 290ms 15ms 41.5MB 277ms 0ms nim 2.2.2
nim 1.nim 349ms 1.9ms 41.8MB 333ms 0ms nim/clang 2.2.2
wasm 2.rs 376ms 5.1ms 22.0MB 360ms 0ms wasmtime 31.0.0
wasm 1.rs 510ms 12ms 56.1MB 493ms 0ms wasmtime 31.0.0

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 1.nim 52ms 1.5ms 11.5MB 40ms 0ms nim 2.2.2
nim 1.nim 57ms 2.7ms 11.8MB 50ms 0ms nim/clang 2.2.2
wasm 1.rs 99ms 4.3ms 27.0MB 83ms 0ms wasmtime 31.0.0
wasm 2.rs 100ms 2.4ms 18.4MB 83ms 7ms wasmtime 31.0.0

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 2211ms 7.5ms 18.2MB 2197ms 0ms wasmtime 31.0.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 531ms 6.4ms 17.6MB 513ms 0ms wasmtime 31.0.0

secp256k1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 3610ms 3.0ms 16.9MB 3597ms 0ms wasmtime 31.0.0

Input: 500

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

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 1.nim 3591ms 2.6ms 1.6MB 3580ms 0ms nim/clang 2.2.2
nim 1.nim 3601ms 1.6ms 1.4MB 3590ms 0ms nim 2.2.2
wasm 2.rs 3602ms 4.5ms 16.9MB 3587ms 0ms wasmtime 31.0.0
wasm 7.rs 4912ms 16ms 16.9MB 4897ms 0ms wasmtime 31.0.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 1.nim 901ms 1.4ms 1.8MB 890ms 0ms nim 2.2.2
nim 1.nim 905ms 9.6ms 1.5MB 897ms 0ms nim/clang 2.2.2
wasm 2.rs 910ms 0.9ms 16.7MB 897ms 0ms wasmtime 31.0.0
wasm 7.rs 1240ms 9.5ms 16.9MB 1230ms 0ms wasmtime 31.0.0

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 1.nim 227ms 0.3ms 1.5MB 220ms 0ms nim/clang 2.2.2
nim 1.nim 229ms 1.8ms 1.3MB 220ms 0ms nim 2.2.2
wasm 2.rs 235ms 1.1ms 17.2MB 220ms 0ms wasmtime 31.0.0
wasm 7.rs 321ms 11ms 16.8MB 307ms 0ms wasmtime 31.0.0