Perl VS Nim benchmarks

Current benchmark data was generated on Sat Jan 28 2023, 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
nim 2.nim 1946ms 26ms 35.1MB 1927ms 3ms nim 1.6.10
nim 2.nim 2142ms 32ms 35.5MB 2120ms 7ms nim/clang 1.6.10
perl 1.pl timeout 0.0ms 77.7MB 4957ms 23ms perl 5.36.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 2.nim 183ms 0.2ms 5.5MB 170ms 0ms nim 1.6.10
nim 2.nim 195ms 1.2ms 5.7MB 187ms 0ms nim/clang 1.6.10
perl 1.pl 2227ms 6.1ms 14.0MB 2217ms 0ms perl 5.36.0

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 2.nim 268ms 0.2ms 1.0MB 260ms 0ms nim 1.6.10
nim 2.nim 335ms 0.2ms 1.3MB 327ms 0ms nim/clang 1.6.10
nim 1.nim 779ms 4.3ms 1.1MB 687ms 73ms nim 1.6.10
nim 1.nim 796ms 1.3ms 1.2MB 687ms 93ms nim/clang 1.6.10
perl 1.pl 4480ms 19ms 11.1MB 4463ms 0ms perl 5.36.0

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 2.nim 32ms 3.0ms 1.1MB 20ms 0ms nim 1.6.10
nim 2.nim 37ms 2.3ms 1.3MB 27ms 0ms nim/clang 1.6.10
nim 1.nim 79ms 0.1ms 1.1MB 57ms 7ms nim 1.6.10
nim 1.nim 83ms 1.7ms 1.3MB 67ms 3ms nim/clang 1.6.10
perl 1.pl 453ms 0.2ms 6.7MB 440ms 0ms perl 5.36.0

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 1.nim 1.5ms 0.8ms 1.3MB 0ms 0ms nim/clang 1.6.10
nim 1.nim 1.7ms 0.7ms 1.0MB 0ms 0ms nim 1.6.10
perl 1.pl 2.8ms 0.7ms 5.0MB 0ms 0ms perl 5.36.0

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 2.nim 381ms 0.4ms 1.3MB 370ms 0ms nim 1.6.10
nim 2.nim 412ms 3.2ms 1.3MB 403ms 0ms nim/clang 1.6.10
perl 2.pl timeout 0.0ms 6.3MB 4987ms 0ms perl 5.36.0

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 2.nim 40ms 0.0ms 1.4MB 30ms 0ms nim 1.6.10
nim 2.nim 43ms 0.2ms 1.2MB 30ms 0ms nim/clang 1.6.10
perl 2.pl 3265ms 78ms 6.2MB 3257ms 0ms perl 5.36.0

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 1.nim 4118ms 2.6ms 1.3MB 4107ms 0ms nim/clang 1.6.10
nim 1.nim 4118ms 1.5ms 1.3MB 4107ms 0ms nim 1.6.10
perl 4.pl timeout 0.0ms 8.2MB 9867ms 10ms perl 5.36.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 1.nim 1031ms 0.1ms 1.2MB 1020ms 0ms nim/clang 1.6.10
nim 1.nim 1033ms 3.1ms 1.3MB 1020ms 0ms nim 1.6.10
perl 4.pl timeout 0.0ms 9.7MB 9723ms 3ms perl 5.36.0

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 1.nim 260ms 0.1ms 1.3MB 250ms 0ms nim 1.6.10
nim 1.nim 261ms 0.1ms 1.3MB 250ms 0ms nim/clang 1.6.10
perl 4-m.pl 4983ms 17ms 9.4MB 9713ms 3ms perl 5.36.0