Perl VS Python benchmarks

Current benchmark data was generated on Mon Oct 03 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
python 1.py 1472ms 22ms 274.2MB 1347ms 113ms pypy 3.8.13
perl 1.pl timeout 0.0ms 0.0MB 0ms 0ms perl 5.36.0
python 1.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.7
python 1.py timeout 0.0ms 0.0MB 0ms 0ms pyston 3.8.12

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 126ms 20ms 83.2MB 90ms 13ms pypy 3.8.13
python 1.py 607ms 2.1ms 11.9MB 577ms 7ms pyston 3.8.12
python 1.py 1507ms 5.3ms 11.9MB 1493ms 0ms cpython 3.10.7
perl 1.pl 2233ms 28ms 14.3MB 2210ms 7ms perl 5.36.0

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 2517ms 15ms 91.2MB 2477ms 23ms pypy 3.8.13
python 5-m.py 3868ms 429ms 12.7MB 5843ms 990ms pyston 3.8.12
python 5-m.py 3977ms 29ms 85.3MB 5397ms 1067ms pypy 3.8.13
python 1.py 4077ms 6.7ms 7.9MB 4053ms 7ms pyston 3.8.12
python 5-m.py 4457ms 38ms 12.1MB 6397ms 1020ms cpython 3.10.7
perl 1.pl 4504ms 60ms 11.1MB 4493ms 0ms perl 5.36.0
python 1.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.7

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 332ms 0.7ms 81.8MB 303ms 13ms pypy 3.8.13
python 1.py 425ms 3.2ms 7.9MB 410ms 0ms pyston 3.8.12
python 5-m.py 425ms 34ms 12.6MB 587ms 123ms pyston 3.8.12
perl 1.pl 458ms 4.3ms 6.7MB 443ms 0ms perl 5.36.0
python 5-m.py 535ms 34ms 12.0MB 680ms 137ms cpython 3.10.7
python 1.py 708ms 1.9ms 7.7MB 693ms 0ms cpython 3.10.7
python 5-m.py 815ms 3.9ms 85.3MB 753ms 367ms pypy 3.8.13

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
perl 1.pl 2.5ms 0.2ms 5.0MB 0ms 0ms perl 5.36.0
python 1.py 14ms 0.8ms 7.3MB 10ms 0ms pyston 3.8.12
python 1.py 14ms 0.6ms 7.6MB 10ms 0ms cpython 3.10.7
python 1.py 32ms 0.6ms 54.9MB 16ms 2ms pypy 3.8.13

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 2.py 1898ms 18ms 79.9MB 1873ms 10ms pypy 3.8.13
perl 2.pl timeout 0.0ms 0.0MB 0ms 0ms perl 5.36.0
python 1.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.7
python 2.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.7
python 1.py timeout 0.0ms 0.0MB 0ms 0ms pypy 3.8.13
python 1.py timeout 0.0ms 0.0MB 0ms 0ms pyston 3.8.12
python 2.py timeout 0.0ms 0.0MB 0ms 0ms pyston 3.8.12

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 2.py 249ms 3.9ms 79.8MB 220ms 10ms pypy 3.8.13
python 1.py 560ms 16ms 79.4MB 523ms 13ms pypy 3.8.13
python 1.py 1195ms 5.3ms 8.3MB 1180ms 0ms pyston 3.8.12
python 2.py 1583ms 1.2ms 8.2MB 1570ms 0ms pyston 3.8.12
perl 2.pl 3226ms 23ms 6.3MB 3213ms 0ms perl 5.36.0
python 1.py 4606ms 4.4ms 7.2MB 4597ms 0ms cpython 3.10.7
python 2.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.7

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
perl 4.pl timeout 0.0ms 0.0MB 0ms 0ms perl 5.36.0
python 8.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.7
python 8.py timeout 0.0ms 0.0MB 0ms 0ms pypy 3.8.13
python 8.py timeout 0.0ms 0.0MB 0ms 0ms 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 0.0MB 0ms 0ms perl 5.36.0
python 8.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.7
python 8.py timeout 0.0ms 0.0MB 0ms 0ms pypy 3.8.13
python 8.py timeout 0.0ms 0.0MB 0ms 0ms pyston 3.8.12

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 8-m.py 3224ms 95ms 109.9MB 5487ms 373ms pypy 3.8.13
perl 4.pl timeout 0.0ms 0.0MB 0ms 0ms perl 5.36.0
python 8.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.7
python 8.py timeout 0.0ms 0.0MB 0ms 0ms pyston 3.8.12