Zig VS Lua benchmarks

Current benchmark data was generated on Wed May 25 2022, 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
lua 1.lua timeout 0.0ms 0.0MB 0ms 0ms lua 5.4.4
lua 1.lua timeout 0.0ms 0.0MB 0ms 0ms luajit 2.1.0
zig 1.zig timeout 0.0ms 0.0MB 0ms 0ms zig 0.10.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
lua 1.lua 542ms 22ms 25.2MB 523ms 7ms luajit 2.1.0
lua 1.lua 1204ms 6.2ms 17.3MB 1183ms 3ms lua 5.4.4
zig 1.zig 3757ms 23ms 8.0MB 3033ms 690ms zig 0.10.0

edigits

Input: 250001

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig timeout 0.0ms 0.0MB 0ms 0ms zig 0.10.0

Input: 100000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 907ms 1.0ms 0.5MB 813ms 77ms zig 0.10.0

fannkuch-redux

Input: 11

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2-m.zig 1127ms 11ms 0.0MB 2177ms 0ms zig 0.10.0
zig 2.zig 2403ms 4.4ms 0.0MB 2387ms 3ms zig 0.10.0
zig 1.zig 3174ms 228ms 0.1MB 3163ms 0ms zig 0.10.0

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2-m.zig 99ms 0.3ms 0.0MB 170ms 0ms zig 0.10.0
zig 2.zig 197ms 14ms 0.0MB 183ms 0ms zig 0.10.0
zig 1.zig 269ms 8.6ms 0.1MB 257ms 0ms zig 0.10.0

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 138ms 0.7ms 0.0MB 120ms 0ms zig 0.10.0

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 16ms 0.3ms 0.0MB 10ms 0ms zig 0.10.0

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 1.8ms 0.8ms 0.1MB 0ms 0ms zig 0.10.0
lua 1.lua 2.1ms 0.7ms 2.2MB 0ms 0ms luajit 2.1.0
lua 1.lua 3.1ms 1.1ms 1.1MB 0ms 0ms lua 5.4.4

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 50ms 0.3ms 1.6MB 40ms 0ms zig 0.10.0

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 145ms 2.9ms 1.6MB 133ms 0ms zig 0.10.0

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 24ms 0.2ms 0.0MB 10ms 0ms zig 0.10.0

mandelbrot

Input: 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 349ms 20ms 3.1MB 337ms 0ms zig 0.10.0

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 17ms 1.0ms 0.0MB 10ms 0ms zig 0.10.0

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
lua 1.lua timeout 0.0ms 0.0MB 0ms 0ms lua 5.4.4
lua 1.lua timeout 0.0ms 0.0MB 0ms 0ms luajit 2.1.0
zig 1.zig timeout 0.0ms 0.0MB 0ms 0ms zig 0.10.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
lua 1.lua 2331ms 46ms 35.3MB 2293ms 17ms luajit 2.1.0
lua 1.lua 3310ms 64ms 41.5MB 3277ms 20ms lua 5.4.4
zig 1.zig timeout 0.0ms 0.0MB 0ms 0ms zig 0.10.0

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2.zig 255ms 2.2ms 0.0MB 240ms 0ms zig 0.10.0
zig 1.zig 383ms 3.0ms 0.0MB 370ms 0ms zig 0.10.0
lua 4.lua 1120ms 8.4ms 1.1MB 1107ms 0ms luajit 2.1.0
lua 4.lua timeout 0.0ms 0.0MB 0ms 0ms lua 5.4.4

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2.zig 29ms 2.9ms 0.0MB 20ms 0ms zig 0.10.0
zig 1.zig 41ms 1.0ms 0.0MB 30ms 0ms zig 0.10.0
lua 4.lua 116ms 1.0ms 1.0MB 100ms 0ms luajit 2.1.0
lua 4.lua 1449ms 38ms 1.1MB 1433ms 0ms lua 5.4.4

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2.zig 378ms 1.9ms 4.9MB 367ms 0ms zig 0.10.0
zig 1.zig 1136ms 42ms 39.1MB 1107ms 13ms zig 0.10.0

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2.zig 82ms 4.7ms 1.1MB 70ms 0ms zig 0.10.0
zig 1.zig 119ms 7.8ms 9.6MB 103ms 0ms zig 0.10.0

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig timeout 0.0ms 0.0MB 0ms 0ms zig 0.10.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 2845ms 10ms 0.4MB 1060ms 1770ms zig 0.10.0

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2-m.zig 893ms 1.7ms 0.3MB 1660ms 0ms zig 0.10.0
zig 2.zig 1660ms 114ms 0.0MB 1650ms 0ms zig 0.10.0
zig 1.zig 3381ms 16ms 0.1MB 3370ms 0ms zig 0.10.0
lua 1.lua timeout 0.0ms 0.0MB 0ms 0ms lua 5.4.4
lua 1.lua timeout 0.0ms 0.0MB 0ms 0ms luajit 2.1.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2-m.zig 230ms 1.2ms 0.2MB 410ms 0ms zig 0.10.0
zig 2.zig 420ms 28ms 0.0MB 413ms 0ms zig 0.10.0
zig 1.zig 850ms 1.6ms 0.1MB 840ms 0ms zig 0.10.0
lua 1.lua 1357ms 86ms 2.4MB 1347ms 0ms luajit 2.1.0
lua 1.lua timeout 0.0ms 0.0MB 0ms 0ms lua 5.4.4

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2-m.zig 65ms 2.2ms 0.2MB 93ms 0ms zig 0.10.0
zig 2.zig 100ms 0.4ms 0.0MB 90ms 0ms zig 0.10.0
zig 1.zig 226ms 22ms 0.1MB 213ms 0ms zig 0.10.0
lua 1.lua 325ms 27ms 2.4MB 313ms 0ms luajit 2.1.0
lua 1.lua timeout 0.0ms 0.0MB 0ms 0ms lua 5.4.4