Perl VS Python benchmarks

Current benchmark data was generated on Mon Apr 14 2025, full log can be found HERE

CONTRIBUTIONS are WELCOME!

[x86_64][4 cores] AMD EPYC 7763 64-Core Processor (Model 1)

* -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 1213ms 9.6ms 96.3MB 1153ms 47ms pypy 3.10.16
perl 1.pl timeout 0.0ms 77.8MB 4957ms 30ms perl 5.40.1
python 1.py timeout 0.0ms 40.9MB 4967ms 17ms cpython 3.13.3
python 1.py timeout 0.0ms 40.5MB 4760ms 227ms pyston 3.8.12

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 97ms 0.7ms 68.7MB 70ms 20ms pypy 3.10.16
python 1.py 477ms 2.7ms 11.9MB 450ms 10ms pyston 3.8.12
python 1.py 732ms 10.0ms 12.8MB 720ms 0ms cpython 3.13.3
perl 1.pl 1814ms 6.8ms 14.4MB 1800ms 0ms perl 5.40.1

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 1856ms 3.7ms 88.7MB 1810ms 33ms pypy 3.10.16
python 5-m.py 2281ms 14ms 65.4MB 3517ms 857ms pypy 3.10.16
python 5-m.py 2454ms 16ms 12.5MB 3597ms 933ms pyston 3.8.12
python 1.py 3039ms 6.1ms 8.1MB 3027ms 0ms pyston 3.8.12
python 5-m.py 3378ms 6.8ms 13.9MB 4507ms 907ms cpython 3.13.3
perl 1.pl 3655ms 59ms 10.9MB 3640ms 0ms perl 5.40.1
python 1.py 4717ms 37ms 8.9MB 4703ms 0ms cpython 3.13.3

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 253ms 4.7ms 63.3MB 227ms 10ms pypy 3.10.16
python 5-m.py 311ms 6.2ms 12.5MB 407ms 143ms pyston 3.8.12
python 1.py 313ms 1.7ms 8.1MB 300ms 0ms pyston 3.8.12
perl 1.pl 377ms 6.8ms 6.6MB 363ms 0ms perl 5.40.1
python 5-m.py 410ms 4.8ms 13.8MB 487ms 147ms cpython 3.13.3
python 5-m.py 451ms 3.7ms 65.4MB 747ms 310ms pypy 3.10.16
python 1.py 498ms 22ms 8.9MB 483ms 0ms cpython 3.13.3

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
perl 1.pl 2.7ms 0.2ms 5.1MB 0ms 0ms perl 5.40.1
python 1.py 11ms 0.9ms 7.8MB 0ms 0ms pyston 3.8.12
python 1.py 14ms 1.3ms 8.6MB 10ms 0ms cpython 3.13.3
python 1.py 28ms 0.4ms 51.6MB 10ms 10ms pypy 3.10.16

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 2.py 1350ms 3.5ms 57.9MB 1327ms 10ms pypy 3.10.16
python 1.py 2654ms 20ms 57.2MB 2627ms 13ms pypy 3.10.16
perl 2.pl timeout 0.0ms 6.1MB 4990ms 0ms perl 5.40.1
python 1.py timeout 0.0ms 8.9MB 4990ms 0ms cpython 3.13.3
python 2.py timeout 0.0ms 8.9MB 4990ms 0ms cpython 3.13.3
python 1.py timeout 0.0ms 8.3MB 4990ms 0ms pyston 3.8.12
python 2.py timeout 0.0ms 8.1MB 4990ms 0ms pyston 3.8.12

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 2.py 177ms 2.0ms 57.9MB 157ms 10ms pypy 3.10.16
python 1.py 309ms 11ms 57.1MB 287ms 7ms pypy 3.10.16
python 1.py 1009ms 134ms 8.3MB 997ms 0ms pyston 3.8.12
python 2.py 1304ms 5.0ms 8.3MB 1293ms 0ms pyston 3.8.12
perl 2.pl 2936ms 340ms 6.1MB 2927ms 0ms perl 5.40.1
python 1.py 2984ms 72ms 8.8MB 2970ms 0ms cpython 3.13.3
python 2.py 3398ms 9.8ms 8.9MB 3387ms 0ms cpython 3.13.3

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
perl 4.pl timeout 0.0ms 9.8MB 19750ms 10ms perl 5.40.1
python 8.py timeout 0.0ms 14.8MB 40ms 7ms cpython 3.13.3
python 8.py timeout 0.0ms 96.8MB 803ms 73ms pypy 3.10.16
python 8.py timeout 0.0ms 14.1MB 33ms 10ms 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 10.1MB 19607ms 7ms perl 5.40.1
python 8.py timeout 0.0ms 14.6MB 50ms 10ms cpython 3.13.3
python 8.py timeout 0.0ms 96.2MB 1303ms 180ms pypy 3.10.16
python 8.py timeout 0.0ms 13.7MB 57ms 20ms pyston 3.8.12

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 8-m.py 1955ms 10ms 93.2MB 6330ms 253ms pypy 3.10.16
perl 4-m.pl 3406ms 24ms 9.6MB 13197ms 10ms perl 5.40.1
python 8.py timeout 0.0ms 14.3MB 90ms 13ms cpython 3.13.3
python 8.py timeout 0.0ms 13.1MB 127ms 37ms pyston 3.8.12