Lua VS Crystal benchmarks

Current benchmark data was generated on Thu Sep 22 2022, full log can be found HERE

CONTRIBUTIONS are WELCOME!

[x86_64][2 cores] Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz (Model 106)

* -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
crystal 1.cr 1541ms 5.5ms 66.2MB 1840ms 17ms crystal 1.5.1
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-beta3

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 131ms 0.2ms 13.1MB 140ms 0ms crystal 1.5.1
lua 1.lua 425ms 4.0ms 25.1MB 407ms 3ms luajit 2.1.0-beta3
lua 1.lua 1077ms 22ms 17.3MB 1060ms 0ms lua 5.4.4

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
lua 1.lua 1.9ms 0.7ms 1.1MB 0ms 0ms lua 5.4.4
lua 1.lua 2.5ms 0.6ms 2.2MB 0ms 0ms luajit 2.1.0-beta3
crystal 1.cr 4.6ms 2.2ms 3.1MB 0ms 0ms crystal 1.5.1

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 1083ms 49ms 64.3MB 1230ms 23ms crystal 1.5.1
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-beta3

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 207ms 6.9ms 17.5MB 223ms 3ms crystal 1.5.1
lua 1.lua 1915ms 391ms 60.4MB 1883ms 13ms luajit 2.1.0-beta3
lua 1.lua 2862ms 51ms 41.5MB 2833ms 13ms lua 5.4.4

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 516ms 4.8ms 2.9MB 500ms 0ms crystal 1.5.1
crystal 2.cr 540ms 0.7ms 2.9MB 530ms 0ms crystal 1.5.1
lua 4.lua 1098ms 7.1ms 1.0MB 1083ms 0ms luajit 2.1.0-beta3
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
crystal 1.cr 56ms 1.6ms 3.0MB 50ms 0ms crystal 1.5.1
crystal 2.cr 60ms 2.8ms 2.9MB 43ms 0ms crystal 1.5.1
lua 4.lua 115ms 1.8ms 2.2MB 100ms 0ms luajit 2.1.0-beta3
lua 4.lua 1172ms 2.9ms 1.1MB 1160ms 0ms lua 5.4.4

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr timeout 0.0ms 0.0MB 0ms 0ms crystal 1.5.1
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-beta3

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
crystal 1.cr 1510ms 2.5ms 5.8MB 1493ms 0ms crystal 1.5.1
lua 1.lua 1555ms 2.0ms 2.4MB 1547ms 0ms luajit 2.1.0-beta3
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
crystal 1.cr 382ms 1.3ms 3.8MB 370ms 0ms crystal 1.5.1
lua 1.lua 392ms 1.3ms 1.1MB 380ms 0ms luajit 2.1.0-beta3
lua 1.lua timeout 0.0ms 0.0MB 0ms 0ms lua 5.4.4

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
lua 1.lua 557ms 1.7ms 5.0MB 547ms 0ms luajit 2.1.0-beta3
crystal 1.cr 1972ms 20ms 22.3MB 1920ms 30ms crystal 1.5.1

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
lua 1.lua 39ms 1.6ms 2.9MB 30ms 0ms luajit 2.1.0-beta3
crystal 1.cr 110ms 4.1ms 7.6MB 97ms 3ms crystal 1.5.1