Perl VS Python 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.)

binarytrees

Input: 18

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 1922ms 8.8ms 217.4MB 1770ms 137ms pypy 3.9.16
perl 1.pl timeout 0.0ms 77.7MB 4957ms 27ms perl 5.36.0
python 1.py timeout 0.0ms 40.8MB 4963ms 17ms cpython 3.11.2
python 1.py timeout 0.0ms 40.3MB 4950ms 27ms pyston 3.8.12

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 148ms 2.4ms 74.3MB 113ms 13ms pypy 3.9.16
python 1.py 776ms 2.6ms 11.9MB 753ms 7ms pyston 3.8.12
python 1.py 1144ms 6.2ms 12.5MB 1120ms 3ms cpython 3.11.2
perl 1.pl 2570ms 26ms 14.3MB 2550ms 3ms perl 5.36.0

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 5-m.py 3319ms 2874ms 76.1MB 6847ms 1390ms pypy 3.9.16
python 1.py 3477ms 32ms 84.7MB 3433ms 23ms pypy 3.9.16
python 5-m.py 3960ms 31ms 12.5MB 5733ms 1390ms pyston 3.8.12
python 1.py 4684ms 24ms 7.9MB 4667ms 0ms pyston 3.8.12
python 5-m.py 4713ms 13ms 13.6MB 6807ms 1347ms cpython 3.11.2
perl 1.pl timeout 0.0ms 11.1MB 4970ms 3ms perl 5.36.0
python 1.py timeout 0.0ms 8.6MB 4977ms 3ms cpython 3.11.2

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 425ms 2.0ms 73.7MB 383ms 23ms pypy 3.9.16
python 5-m.py 479ms 2.6ms 12.6MB 630ms 173ms pyston 3.8.12
python 1.py 495ms 15ms 7.9MB 480ms 0ms pyston 3.8.12
perl 1.pl 536ms 6.3ms 6.8MB 523ms 0ms perl 5.36.0
python 5-m.py 559ms 1.6ms 13.5MB 737ms 167ms cpython 3.11.2
python 1.py 715ms 1.6ms 8.7MB 700ms 0ms cpython 3.11.2
python 5-m.py 932ms 8.4ms 76.0MB 1000ms 530ms pypy 3.9.16

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
perl 1.pl 3.8ms 0.6ms 5.1MB 0ms 0ms perl 5.36.0
python 1.py 15ms 0.7ms 7.3MB 10ms 0ms pyston 3.8.12
python 1.py 16ms 1.3ms 8.5MB 10ms 0ms cpython 3.11.2
python 1.py 39ms 0.9ms 52.8MB 12ms 12ms pypy 3.9.16

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 2.py 2414ms 33ms 71.4MB 2383ms 17ms pypy 3.9.16
python 1.py 4354ms 39ms 70.3MB 4317ms 17ms pypy 3.9.16
perl 2.pl timeout 0.0ms 6.4MB 4987ms 3ms perl 5.36.0
python 1.py timeout 0.0ms 8.4MB 4983ms 0ms cpython 3.11.2
python 2.py timeout 0.0ms 8.6MB 4987ms 0ms cpython 3.11.2
python 1.py timeout 0.0ms 8.4MB 4983ms 3ms pyston 3.8.12
python 2.py timeout 0.0ms 7.9MB 4973ms 7ms pyston 3.8.12

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 2.py 309ms 3.3ms 71.0MB 277ms 17ms pypy 3.9.16
python 1.py 499ms 4.8ms 70.3MB 460ms 20ms pypy 3.9.16
python 1.py 1397ms 19ms 8.3MB 1380ms 0ms pyston 3.8.12
python 2.py 1891ms 7.9ms 7.9MB 1873ms 3ms pyston 3.8.12
perl 2.pl 3680ms 19ms 6.3MB 3667ms 0ms perl 5.36.0
python 1.py 3917ms 146ms 8.4MB 3903ms 0ms cpython 3.11.2
python 2.py 4128ms 39ms 8.6MB 4107ms 0ms cpython 3.11.2

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
perl 4.pl timeout 0.0ms 8.2MB 9847ms 3ms perl 5.36.0
python 8.py timeout 0.0ms 16.5MB 60ms 17ms cpython 3.11.2
python 8.py timeout 0.0ms 98.9MB 643ms 93ms pypy 3.9.16
python 8.py timeout 0.0ms 17.5MB 57ms 20ms pyston 3.8.12

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
perl 4.pl timeout 0.0ms 9.6MB 9703ms 3ms perl 5.36.0
python 8.py timeout 0.0ms 14.3MB 133ms 20ms cpython 3.11.2
python 8.py timeout 0.0ms 103.4MB 1023ms 183ms pypy 3.9.16
python 8.py timeout 0.0ms 17.1MB 150ms 33ms pyston 3.8.12

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 8-m.py 4367ms 34ms 102.1MB 7580ms 460ms pypy 3.9.16
perl 4.pl timeout 0.0ms 8.3MB 9687ms 10ms perl 5.36.0
python 8.py timeout 0.0ms 15.9MB 243ms 33ms cpython 3.11.2
python 8.py timeout 0.0ms 17.1MB 333ms 63ms pyston 3.8.12