Lua VS Rust benchmarks

Current benchmark data was generated on Sat Nov 16 2024, 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
rust 4.rs 1243ms 6.8ms 33.8MB 1220ms 7ms rustc 1.82.0
rust 5.rs 1316ms 2.7ms 33.8MB 1293ms 7ms rustc 1.82.0
rust 3.rs 1481ms 17ms 49.8MB 1453ms 17ms rustc 1.82.0
lua 1.lua 3463ms 70ms 172.8MB 3323ms 123ms luajit 2.1.0-beta3
lua 1.lua timeout 0.0ms 104.9MB 4960ms 27ms lua 5.4.7

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 4.rs 119ms 2.8ms 5.8MB 110ms 0ms rustc 1.82.0
rust 5.rs 126ms 3.2ms 5.8MB 117ms 0ms rustc 1.82.0
rust 3.rs 141ms 2.4ms 7.8MB 130ms 0ms rustc 1.82.0
lua 1.lua 286ms 1.1ms 15.9MB 263ms 7ms luajit 2.1.0-beta3
lua 1.lua 810ms 1.8ms 16.9MB 790ms 0ms lua 5.4.7

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 1.rs 1.3ms 0.1ms 1.8MB 0ms 0ms rustc 1.84.0-nightly
rust 1.rs 1.3ms 0.1ms 1.8MB 0ms 0ms rustc 1.82.0
lua 1.lua 1.4ms 0.1ms 2.4MB 0ms 0ms luajit 2.1.0-beta3
lua 1.lua 1.5ms 0.2ms 2.1MB 0ms 0ms lua 5.4.7

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 1.rs 687ms 1.6ms 33.8MB 663ms 10ms rustc 1.82.0
lua 1.lua timeout 0.0ms 107.4MB 4953ms 33ms lua 5.4.7
lua 1.lua timeout 0.0ms 149.3MB 4933ms 47ms luajit 2.1.0-beta3

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 1.rs 148ms 2.0ms 9.8MB 133ms 0ms rustc 1.82.0
lua 1.lua 1122ms 32ms 31.0MB 1097ms 10ms luajit 2.1.0-beta3
lua 1.lua 2145ms 2.0ms 28.6MB 2120ms 10ms lua 5.4.7

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 4-i.rs 165ms 2.7ms 1.8MB 153ms 0ms rustc 1.82.0
rust 7-i.rs 236ms 1.4ms 1.9MB 230ms 0ms rustc 1.82.0
rust 1.rs 239ms 0.6ms 1.8MB 223ms 0ms rustc 1.82.0
rust 2.rs 278ms 0.5ms 1.8MB 270ms 0ms rustc 1.82.0
rust 3.rs 280ms 0.3ms 1.8MB 270ms 0ms rustc 1.84.0-nightly
lua 4.lua 716ms 7.4ms 2.4MB 707ms 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
rust 4-i.rs 19ms 0.2ms 1.8MB 10ms 0ms rustc 1.82.0
rust 7-i.rs 26ms 0.3ms 1.9MB 17ms 0ms rustc 1.82.0
rust 1.rs 26ms 0.3ms 1.8MB 20ms 0ms rustc 1.82.0
rust 3.rs 30ms 0.1ms 1.9MB 20ms 0ms rustc 1.84.0-nightly
rust 2.rs 30ms 0.0ms 1.8MB 20ms 0ms rustc 1.82.0
lua 4.lua 76ms 2.2ms 2.4MB 67ms 0ms luajit 2.1.0-beta3
lua 4.lua 1120ms 22ms 2.3MB 1107ms 0ms lua 5.4.7

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 8-m.rs 496ms 0.1ms 4.5MB 1907ms 0ms rustc 1.84.0-nightly
rust 7-m.rs 498ms 0.3ms 4.2MB 1917ms 3ms rustc 1.82.0
rust 8.rs 1010ms 2.8ms 2.4MB 1000ms 0ms rustc 1.84.0-nightly
rust 2-m.rs 1936ms 2.2ms 4.1MB 7590ms 7ms rustc 1.82.0
rust 7.rs 2078ms 11ms 1.9MB 2067ms 0ms rustc 1.82.0
lua 1.lua 4052ms 6.0ms 2.5MB 4043ms 0ms luajit 2.1.0-beta3
rust 2.rs 4188ms 1.3ms 2.0MB 4177ms 0ms rustc 1.82.0
lua 1.lua timeout 0.0ms 2.5MB 4990ms 0ms lua 5.4.7

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
rust 8-m.rs 128ms 0.4ms 4.2MB 467ms 3ms rustc 1.84.0-nightly
rust 7-m.rs 128ms 0.2ms 4.1MB 467ms 0ms rustc 1.82.0
rust 8.rs 255ms 0.6ms 2.1MB 247ms 0ms rustc 1.84.0-nightly
rust 2-m.rs 488ms 1.2ms 4.1MB 1873ms 7ms rustc 1.82.0
rust 7.rs 529ms 14ms 1.8MB 517ms 0ms rustc 1.82.0
lua 1.lua 1024ms 0.9ms 2.4MB 1010ms 0ms luajit 2.1.0-beta3
rust 2.rs 1049ms 1.1ms 1.9MB 1040ms 0ms rustc 1.82.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
rust 7-m.rs 36ms 0.3ms 6.1MB 113ms 0ms rustc 1.82.0
rust 8-m.rs 36ms 0.4ms 6.1MB 113ms 0ms rustc 1.84.0-nightly
rust 8.rs 66ms 0.9ms 2.0MB 57ms 0ms rustc 1.84.0-nightly
rust 2-m.rs 126ms 0.2ms 4.1MB 467ms 0ms rustc 1.82.0
rust 7.rs 135ms 3.0ms 1.8MB 123ms 0ms rustc 1.82.0
lua 1.lua 258ms 1.0ms 2.3MB 247ms 0ms luajit 2.1.0-beta3
rust 2.rs 266ms 1.0ms 1.9MB 253ms 0ms rustc 1.82.0
lua 1.lua timeout 0.0ms 2.1MB 4990ms 0ms lua 5.4.7