Lua VS Wasm benchmarks

Current benchmark data was generated on Mon Mar 31 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 1797ms 32ms 33.1MB 1777ms 10ms wasmtime 31.0.0
wasm 3.rs 1834ms 21ms 49.1MB 1803ms 20ms wasmtime 31.0.0
wasm 4.rs 1842ms 12ms 33.1MB 1823ms 7ms wasmtime 31.0.0
lua 1.lua 3623ms 23ms 173.0MB 3477ms 133ms luajit 2.1.0-beta3
lua 1.lua timeout 0.0ms 104.9MB 4953ms 33ms lua 5.4.7

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 5.rs 170ms 3.3ms 19.1MB 157ms 0ms wasmtime 31.0.0
wasm 4.rs 181ms 5.1ms 19.2MB 167ms 0ms wasmtime 31.0.0
wasm 3.rs 181ms 5.6ms 21.2MB 167ms 0ms wasmtime 31.0.0
lua 1.lua 292ms 3.1ms 15.9MB 267ms 10ms luajit 2.1.0-beta3
lua 1.lua 824ms 5.5ms 16.9MB 807ms 0ms lua 5.4.7

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
lua 1.lua 1.5ms 0.2ms 2.3MB 0ms 0ms luajit 2.1.0-beta3
lua 1.lua 1.6ms 0.1ms 2.1MB 0ms 0ms lua 5.4.7
wasm 1.rs 7.2ms 0.3ms 17.1MB 0ms 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 887ms 2.5ms 41.3MB 863ms 10ms wasmtime 31.0.0
lua 1.lua timeout 0.0ms 107.4MB 4947ms 37ms lua 5.4.7
lua 1.lua timeout 0.0ms 149.4MB 4923ms 63ms luajit 2.1.0-beta3

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 195ms 1.6ms 23.1MB 180ms 0ms wasmtime 31.0.0
lua 1.lua 1392ms 85ms 31.1MB 1360ms 13ms luajit 2.1.0-beta3
lua 1.lua 2291ms 16ms 28.6MB 2270ms 10ms lua 5.4.7

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 410ms 2.0ms 17.0MB 400ms 0ms wasmtime 31.0.0
wasm 2.rs 581ms 2.6ms 17.0MB 570ms 0ms wasmtime 31.0.0
lua 4.lua 713ms 1.8ms 2.3MB 703ms 0ms luajit 2.1.0-beta3
lua 4.lua timeout 0.0ms 2.3MB 4990ms 0ms lua 5.4.7

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 49ms 1.2ms 17.0MB 37ms 0ms wasmtime 31.0.0
wasm 2.rs 65ms 0.3ms 17.2MB 50ms 0ms wasmtime 31.0.0
lua 4.lua 75ms 1.1ms 2.4MB 70ms 0ms luajit 2.1.0-beta3
lua 4.lua 1112ms 26ms 2.3MB 1103ms 0ms lua 5.4.7

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 3595ms 1.5ms 16.9MB 3580ms 0ms wasmtime 31.0.0
lua 1.lua 4068ms 9.8ms 2.5MB 4057ms 0ms luajit 2.1.0-beta3
wasm 7.rs 4901ms 6.9ms 17.1MB 4887ms 0ms wasmtime 31.0.0
lua 1.lua timeout 0.0ms 2.4MB 4990ms 0ms lua 5.4.7

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 907ms 1.5ms 16.9MB 893ms 0ms wasmtime 31.0.0
lua 1.lua 1021ms 2.2ms 2.4MB 1010ms 0ms luajit 2.1.0-beta3
wasm 7.rs 1232ms 2.1ms 17.4MB 1220ms 0ms wasmtime 31.0.0
lua 1.lua timeout 0.0ms 2.1MB 4990ms 0ms lua 5.4.7

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 234ms 1.3ms 16.7MB 220ms 0ms wasmtime 31.0.0
lua 1.lua 261ms 2.8ms 2.3MB 250ms 0ms luajit 2.1.0-beta3
wasm 7.rs 315ms 0.6ms 16.7MB 300ms 0ms wasmtime 31.0.0
lua 1.lua timeout 0.0ms 2.0MB 4990ms 0ms lua 5.4.7