Wasm VS D 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
d 1.d 2543ms 10.0ms 312.3MB 2467ms 83ms ldc2 1.32.1
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
d 1.d 3482ms 11ms 314.1MB 3540ms 90ms dmd 2.103.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
d 1.d 264ms 2.3ms 208.9MB 210ms 40ms ldc2 1.32.1
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
d 1.d 332ms 1.7ms 210.5MB 263ms 47ms dmd 2.103.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
d 1.d timeout 0.0ms 13.8MB 4977ms 7ms dmd 2.103.1
d 1.d timeout 0.0ms 13.9MB 4973ms 7ms ldc2 1.32.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
d 1.d 1236ms 7.1ms 8.4MB 1220ms 3ms ldc2 1.32.1
d 1.d 1639ms 18ms 10.3MB 1617ms 3ms dmd 2.103.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
d 1.d timeout 0.0ms 9.6MB 4980ms 3ms dmd 2.103.1
d 1.d timeout 0.0ms 7.7MB 4987ms 0ms ldc2 1.32.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
d 1.d 968ms 2.0ms 6.6MB 953ms 0ms ldc2 1.32.1
d 1.d 1048ms 0.7ms 8.7MB 1040ms 0ms dmd 2.103.1

fannkuch-redux

Input: 11

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1-im.d 658ms 7.5ms 1.5MB 1253ms 0ms ldc2 1.32.1
d 1-i.d 1291ms 2.0ms 1.6MB 1280ms 0ms ldc2 1.32.1
d 2-im.d 2612ms 31ms 1.5MB 5070ms 0ms ldc2 1.32.1
d 1.d 3877ms 10ms 1.5MB 3863ms 0ms ldc2 1.32.1
d 1.d 4782ms 2.5ms 2.8MB 4767ms 0ms dmd 2.103.1
d 1-i.d timeout 0.0ms 2.7MB 4983ms 0ms dmd 2.103.1
d 1-im.d timeout 0.0ms 4.8MB 9813ms 3ms dmd 2.103.1
d 2-i.d timeout 0.0ms 2.9MB 4983ms 0ms dmd 2.103.1
d 2-im.d timeout 0.0ms 2.9MB 9823ms 3ms dmd 2.103.1
d 2-i.d timeout 0.0ms 1.5MB 4990ms 0ms ldc2 1.32.1
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
d 1-im.d 65ms 2.6ms 1.5MB 100ms 0ms ldc2 1.32.1
d 1-i.d 110ms 0.7ms 1.6MB 100ms 0ms ldc2 1.32.1
d 2-im.d 227ms 4.3ms 1.5MB 410ms 0ms ldc2 1.32.1
d 1.d 326ms 2.9ms 1.5MB 313ms 0ms ldc2 1.32.1
d 1.d 393ms 0.5ms 2.8MB 380ms 0ms dmd 2.103.1
d 2-i.d 417ms 0.9ms 1.5MB 407ms 0ms ldc2 1.32.1
wasm 1.rs 448ms 9.2ms 15.6MB 430ms 0ms wasmtime 8.0.1
d 1-im.d 458ms 4.1ms 4.6MB 870ms 0ms dmd 2.103.1
wasm 1.rs 515ms 3.5ms 16.0MB 500ms 0ms wasmedgec 0.12.0
d 2-im.d 760ms 3.9ms 2.8MB 1443ms 3ms dmd 2.103.1
wasm 1.rs 796ms 4.0ms 48.9MB 780ms 10ms node 18.16.0
d 1-i.d 867ms 3.0ms 2.6MB 857ms 0ms dmd 2.103.1
d 2-i.d 1382ms 0.7ms 2.8MB 1370ms 0ms dmd 2.103.1

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 213ms 1.6ms 30.9MB 187ms 13ms ldc2 1.32.1
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
d 1.d 661ms 2.6ms 39.0MB 640ms 10ms dmd 2.103.1

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 27ms 3.1ms 7.0MB 20ms 0ms ldc2 1.32.1
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
d 1.d 70ms 0.9ms 11.7MB 50ms 3ms dmd 2.103.1
wasm 1.rs 94ms 3.1ms 49.2MB 77ms 3ms node 18.16.0

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 2.9ms 1.1ms 2.9MB 0ms 0ms ldc2 1.32.1
d 1.d 3.0ms 0.6ms 4.8MB 0ms 0ms dmd 2.103.1
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

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
d 1.d 172ms 1.7ms 4.1MB 160ms 0ms ldc2 1.32.1
wasm 1.rs 192ms 6.2ms 15.8MB 177ms 0ms wasmtime 8.0.1
d 1.d 256ms 0.9ms 5.6MB 250ms 0ms dmd 2.103.1
wasm 1.rs 269ms 3.7ms 53.8MB 260ms 7ms node 18.16.0

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
d 1.d 497ms 1.0ms 3.7MB 490ms 0ms ldc2 1.32.1
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
d 1.d 756ms 0.3ms 7.6MB 747ms 0ms dmd 2.103.1

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 74ms 1.1ms 3.8MB 63ms 0ms ldc2 1.32.1
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
d 1.d 112ms 0.1ms 5.8MB 103ms 0ms dmd 2.103.1
wasm 1.rs 157ms 1.4ms 51.3MB 150ms 7ms node 18.16.0

mandelbrot

Input: 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 501ms 1.7ms 7.3MB 483ms 0ms ldc2 1.32.1
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
d 1.d 2929ms 184ms 8.1MB 2913ms 0ms dmd 2.103.1

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 26ms 3.1ms 3.1MB 13ms 0ms ldc2 1.32.1
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
d 1.d 119ms 0.3ms 4.4MB 110ms 0ms dmd 2.103.1

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
d 1.d 1473ms 0.7ms 312.7MB 1390ms 80ms ldc2 1.32.1
d 1.d 2312ms 50ms 314.2MB 2320ms 80ms dmd 2.103.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
d 1.d 348ms 14ms 312.4MB 260ms 70ms ldc2 1.32.1
d 1.d 490ms 5.3ms 314.4MB 397ms 83ms dmd 2.103.1

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 456ms 8.0ms 1.5MB 443ms 0ms ldc2 1.32.1
d 2.d 484ms 0.9ms 1.6MB 470ms 0ms ldc2 1.32.1
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
d 1.d 1251ms 1.9ms 2.8MB 1240ms 0ms dmd 2.103.1
d 2.d 2175ms 2.8ms 2.9MB 2160ms 0ms dmd 2.103.1

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 49ms 0.7ms 1.6MB 40ms 0ms ldc2 1.32.1
d 2.d 51ms 0.9ms 1.6MB 40ms 0ms ldc2 1.32.1
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
d 1.d 130ms 2.4ms 2.8MB 120ms 0ms dmd 2.103.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
d 2.d 222ms 1.8ms 2.8MB 210ms 0ms dmd 2.103.1

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
d 2.d 869ms 1.6ms 47.9MB 837ms 13ms ldc2 1.32.1
d 1.d 1034ms 18ms 43.6MB 1007ms 10ms ldc2 1.32.1
d 1.d 1133ms 46ms 76.5MB 1107ms 7ms dmd 2.103.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
d 2.d 1531ms 1.7ms 49.5MB 1497ms 17ms dmd 2.103.1
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

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 131ms 3.4ms 14.0MB 113ms 3ms ldc2 1.32.1
wasm 2.rs 135ms 1.5ms 18.6MB 120ms 0ms wasmedgec 0.12.0
d 1.d 139ms 1.8ms 24.4MB 117ms 7ms dmd 2.103.1
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
d 2.d 204ms 0.0ms 15.4MB 190ms 0ms ldc2 1.32.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
d 2.d 382ms 1.5ms 17.2MB 363ms 7ms dmd 2.103.1

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
d 1.d 3763ms 8.5ms 7.9MB 3753ms 20ms ldc2 1.32.1
d 1.d timeout 0.0ms 9.7MB 4983ms 20ms dmd 2.103.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
d 1.d 891ms 4.8ms 7.9MB 883ms 0ms ldc2 1.32.1
d 1.d 1462ms 0.9ms 9.7MB 1450ms 3ms dmd 2.103.1

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
d 1.d timeout 0.0ms 6.4MB 4990ms 3ms dmd 2.103.1
d 1.d timeout 0.0ms 3.8MB 4987ms 7ms ldc2 1.32.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
d 1.d 1492ms 4.6ms 3.9MB 1477ms 0ms ldc2 1.32.1
d 1.d 2988ms 7.0ms 6.2MB 2977ms 3ms dmd 2.103.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
d 1.d 3628ms 1.5ms 3.8MB 3613ms 0ms ldc2 1.32.1
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
d 1.d 4199ms 5.9ms 5.2MB 4183ms 0ms dmd 2.103.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
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
d 1.d 911ms 1.8ms 3.5MB 900ms 0ms ldc2 1.32.1
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
d 1.d 1048ms 0.1ms 5.0MB 1040ms 0ms dmd 2.103.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

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
d 1.d 231ms 1.3ms 3.0MB 220ms 0ms ldc2 1.32.1
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
d 1.d 266ms 0.9ms 4.7MB 250ms 0ms dmd 2.103.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