C++ VS Perl benchmarks

Current benchmark data was generated on Wed Feb 08 2023, full log can be found HERE

CONTRIBUTIONS are WELCOME!

[x86_64][2 cores] Intel(R) Xeon(R) Platinum 8171M 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.)

fannkuch-redux

Input: 11

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
cpp 1-im.cpp 794ms 8.7ms 3.9MB 1543ms 0ms clang++ 14.0.0
cpp 1-im.cpp 823ms 2.4ms 1.4MB 1570ms 0ms g++ 12.2.0

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
cpp 1-im.cpp 75ms 1.9ms 4.0MB 127ms 0ms clang++ 14.0.0
cpp 1-im.cpp 79ms 2.5ms 1.4MB 130ms 0ms g++ 12.2.0

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
cpp 1.cpp 2.4ms 0.7ms 1.3MB 0ms 0ms g++ 12.2.0
cpp 1.cpp 2.4ms 0.7ms 1.4MB 0ms 0ms clang++ 14.0.0
perl 1.pl 3.8ms 0.6ms 5.1MB 0ms 0ms perl 5.36.0

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
cpp 0-i.cpp 218ms 1.5ms 1.4MB 203ms 0ms g++ 12.2.0
cpp 0-i.cpp 253ms 4.3ms 1.4MB 243ms 0ms clang++ 14.0.0
cpp 1.cpp 413ms 9.0ms 1.4MB 400ms 0ms g++ 12.2.0
cpp 1.cpp 417ms 9.1ms 1.5MB 407ms 0ms clang++ 14.0.0
perl 2.pl timeout 0.0ms 6.4MB 4987ms 3ms perl 5.36.0

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
cpp 0-i.cpp 25ms 0.3ms 1.3MB 13ms 0ms g++ 12.2.0
cpp 0-i.cpp 28ms 0.2ms 1.4MB 20ms 0ms clang++ 14.0.0
cpp 1.cpp 45ms 0.3ms 1.4MB 40ms 0ms clang++ 14.0.0
cpp 1.cpp 46ms 1.9ms 1.3MB 40ms 0ms g++ 12.2.0
perl 2.pl 3680ms 19ms 6.3MB 3667ms 0ms perl 5.36.0

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
cpp 1.cpp 769ms 8.0ms 7.4MB 750ms 0ms clang++ 14.0.0
cpp 1.cpp 769ms 17ms 7.7MB 753ms 0ms g++ 12.2.0

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
cpp 1.cpp 177ms 1.4ms 4.0MB 167ms 0ms g++ 12.2.0
cpp 1.cpp 185ms 4.4ms 3.9MB 173ms 0ms clang++ 14.0.0

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
cpp 8-m.cpp 1061ms 4.5ms 3.7MB 2067ms 3ms clang++ 14.0.0
cpp 7-m.cpp 1065ms 5.3ms 3.3MB 2080ms 0ms clang++ 14.0.0
cpp 8-m.cpp 1071ms 5.9ms 1.3MB 2087ms 0ms g++ 12.2.0
cpp 7-m.cpp 1071ms 11ms 1.4MB 2073ms 0ms g++ 12.2.0
cpp 6-im.cpp 2187ms 29ms 1.3MB 4277ms 0ms g++ 12.2.0
cpp 6-im.cpp 2209ms 24ms 3.4MB 4327ms 3ms clang++ 14.0.0
perl 4.pl timeout 0.0ms 8.2MB 9847ms 3ms perl 5.36.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
cpp 7-m.cpp 271ms 2.1ms 1.3MB 510ms 0ms g++ 12.2.0
cpp 7-m.cpp 278ms 3.3ms 3.3MB 517ms 0ms clang++ 14.0.0
cpp 8-m.cpp 281ms 2.7ms 1.3MB 523ms 0ms g++ 12.2.0
cpp 8-m.cpp 283ms 8.5ms 3.5MB 527ms 0ms clang++ 14.0.0
cpp 6-im.cpp 546ms 13ms 1.3MB 1053ms 0ms g++ 12.2.0
cpp 6-im.cpp 560ms 0.6ms 3.3MB 1077ms 3ms clang++ 14.0.0
perl 4.pl timeout 0.0ms 9.6MB 9703ms 3ms perl 5.36.0

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
cpp 7-m.cpp 73ms 1.9ms 1.4MB 120ms 0ms g++ 12.2.0
cpp 8-m.cpp 77ms 0.2ms 3.3MB 130ms 0ms clang++ 14.0.0
cpp 8-m.cpp 78ms 1.5ms 1.3MB 130ms 0ms g++ 12.2.0
cpp 7-m.cpp 79ms 2.5ms 3.5MB 130ms 0ms clang++ 14.0.0
cpp 6-im.cpp 151ms 0.9ms 1.3MB 273ms 0ms g++ 12.2.0
cpp 6-im.cpp 152ms 0.4ms 3.7MB 273ms 0ms clang++ 14.0.0
perl 4.pl timeout 0.0ms 8.3MB 9687ms 10ms perl 5.36.0