Python VS Perl benchmarks

Current benchmark data was generated on Fri Aug 05 2022, full log can be found HERE

CONTRIBUTIONS are WELCOME!

[x86_64][2 cores] Intel(R) Xeon(R) Platinum 8272CL 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 1576ms 15ms 220.2MB 1430ms 127ms 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.5
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 124ms 2.7ms 78.7MB 90ms 17ms pypy 3.8.13
python 1.py 660ms 3.3ms 11.9MB 630ms 10ms pyston 3.8.12
python 1.py 1667ms 10ms 11.8MB 1647ms 0ms cpython 3.10.5
perl 1.pl 2149ms 9.7ms 14.3MB 2137ms 0ms perl 5.36.0

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 1250ms 10ms 224.3MB 1143ms 90ms pypy 3.8.13
python 1.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.5
python 1.py timeout 0.0ms 0.0MB 0ms 0ms pyston 3.8.12

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 277ms 2.5ms 90.4MB 233ms 27ms pypy 3.8.13
python 1.py 861ms 5.3ms 16.9MB 840ms 7ms pyston 3.8.12
python 1.py 902ms 0.2ms 16.8MB 877ms 7ms cpython 3.10.5

edigits

Input: 250001

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 722ms 1.1ms 83.1MB 693ms 13ms pypy 3.8.13
python 1.py 2283ms 0.8ms 9.5MB 2263ms 0ms pyston 3.8.12
python 1.py 2330ms 1.9ms 9.2MB 2317ms 0ms cpython 3.10.5

Input: 100000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 198ms 1.6ms 75.9MB 167ms 13ms pypy 3.8.13
python 1.py 400ms 0.9ms 8.9MB 380ms 0ms pyston 3.8.12
python 1.py 417ms 0.4ms 8.5MB 403ms 0ms cpython 3.10.5

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 2838ms 18ms 89.1MB 2793ms 30ms pypy 3.8.13
python 5-m.py 3444ms 42ms 12.5MB 4923ms 1283ms pyston 3.8.12
python 1.py 3963ms 36ms 7.8MB 3943ms 3ms pyston 3.8.12
perl 1.pl 4246ms 8.9ms 11.1MB 4233ms 0ms perl 5.36.0
python 5-m.py 4546ms 38ms 12.0MB 6653ms 1193ms cpython 3.10.5
python 5-m.py 4586ms 30ms 78.8MB 6013ms 1183ms pypy 3.8.13
python 1.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.5

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 369ms 0.6ms 75.4MB 333ms 20ms pypy 3.8.13
python 1.py 413ms 3.5ms 7.8MB 397ms 0ms pyston 3.8.12
python 5-m.py 415ms 5.7ms 12.6MB 567ms 117ms pyston 3.8.12
perl 1.pl 436ms 1.8ms 6.8MB 423ms 0ms perl 5.36.0
python 5-m.py 526ms 1.3ms 12.1MB 707ms 153ms cpython 3.10.5
python 1.py 706ms 1.9ms 7.7MB 693ms 0ms cpython 3.10.5
python 5-m.py 841ms 1.0ms 78.8MB 997ms 413ms 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.4ms 0.3ms 5.1MB 0ms 0ms perl 5.36.0
python 1.py 14ms 0.9ms 7.3MB 10ms 0ms pyston 3.8.12
python 1.py 14ms 0.8ms 7.4MB 10ms 0ms cpython 3.10.5
python 1.py 33ms 1.1ms 54.4MB 10ms 10ms pypy 3.8.13

http-server

Input: 3000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 1703ms 3.4ms 28.9MB 1343ms 1063ms pyston 3.8.12
python 1.py 2366ms 2.4ms 27.2MB 2083ms 1067ms cpython 3.10.5
python 1.py timeout 0.0ms 0.0MB 0ms 0ms pypy 3.8.13

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 379ms 3.6ms 24.1MB 297ms 180ms pyston 3.8.12
python 1.py 467ms 0.3ms 21.8MB 383ms 203ms cpython 3.10.5
python 1.py 1195ms 11ms 102.6MB 973ms 183ms pypy 3.8.13

json-serde

Input: sample 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 262ms 1.3ms 38.3MB 230ms 17ms pyston 3.8.12
python 1.py 270ms 2.9ms 39.5MB 237ms 10ms cpython 3.10.5
python 1.py 437ms 1.6ms 103.8MB 400ms 20ms pypy 3.8.13

Input: canada 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 2430ms 49ms 220.7MB 2297ms 120ms cpython 3.10.5
python 1.py 2439ms 5.7ms 220.6MB 2267ms 160ms pyston 3.8.12
python 1.py 2785ms 18ms 243.3MB 2693ms 77ms pypy 3.8.13

knucleotide

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 3-m.py 4251ms 45ms 211.7MB 7493ms 423ms pypy 3.8.13
python 3.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.5
python 3.py timeout 0.0ms 0.0MB 0ms 0ms pyston 3.8.12

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 3-m.py 575ms 3.7ms 88.7MB 853ms 110ms pypy 3.8.13
python 3-m.py 615ms 2.5ms 16.0MB 1070ms 37ms pyston 3.8.12
python 3-m.py 884ms 8.2ms 15.3MB 1593ms 40ms cpython 3.10.5

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 2.py 230ms 2.4ms 74.3MB 200ms 17ms pypy 3.8.13
python 1.py 275ms 1.8ms 75.5MB 247ms 7ms pypy 3.8.13
python 1.py 947ms 7.7ms 9.0MB 930ms 0ms pyston 3.8.12
python 2.py 1086ms 1.6ms 8.7MB 1070ms 0ms pyston 3.8.12
python 1.py 1769ms 20ms 8.4MB 1753ms 0ms cpython 3.10.5
python 2.py 2559ms 22ms 8.3MB 2550ms 0ms cpython 3.10.5

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 2.py 554ms 2.0ms 74.7MB 523ms 17ms pypy 3.8.13
python 1.py 606ms 1.6ms 76.1MB 580ms 10ms pypy 3.8.13
python 1.py 2796ms 7.6ms 8.9MB 2783ms 0ms pyston 3.8.12
python 2.py 3263ms 23ms 8.7MB 3247ms 0ms pyston 3.8.12
python 1.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.5
python 2.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.5

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 2.py 159ms 0.3ms 74.3MB 130ms 17ms pypy 3.8.13
python 1.py 180ms 3.4ms 74.5MB 147ms 13ms pypy 3.8.13
python 1.py 452ms 0.3ms 8.6MB 437ms 0ms pyston 3.8.12
python 2.py 505ms 5.3ms 8.2MB 490ms 0ms pyston 3.8.12
python 1.py 806ms 4.6ms 7.9MB 790ms 0ms cpython 3.10.5
python 2.py 1231ms 8.5ms 7.4MB 1217ms 0ms cpython 3.10.5

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 2468ms 12ms 234.1MB 2313ms 137ms pypy 3.8.13
python 1.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.5
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 367ms 1.9ms 150.6MB 310ms 43ms pypy 3.8.13
python 1.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.5
python 1.py timeout 0.0ms 0.0MB 0ms 0ms pyston 3.8.12

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 2.py 2010ms 15ms 74.4MB 1980ms 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.5
python 2.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.5
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 260ms 2.1ms 74.2MB 233ms 10ms pypy 3.8.13
python 1.py 556ms 1.7ms 73.3MB 533ms 7ms pypy 3.8.13
python 1.py 1155ms 15ms 7.3MB 1140ms 0ms pyston 3.8.12
python 2.py 1581ms 1.7ms 8.1MB 1567ms 0ms pyston 3.8.12
perl 2.pl 3247ms 133ms 6.3MB 3233ms 0ms perl 5.36.0
python 1.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.5
python 2.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.5

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 4922ms 11ms 385.4MB 4750ms 153ms pypy 3.8.13
python 1.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.5
python 1.py timeout 0.0ms 0.0MB 0ms 0ms pyston 3.8.12

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 1134ms 5.1ms 209.5MB 1063ms 50ms pypy 3.8.13
python 1.py 2473ms 112ms 86.0MB 2420ms 30ms pyston 3.8.12
python 1.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.5

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 4.py 2334ms 3.2ms 8.6MB 2307ms 10ms cpython 3.10.5
python 4.py 2352ms 1.7ms 9.1MB 2310ms 23ms pyston 3.8.12
python 4.py 2555ms 23ms 127.6MB 2497ms 40ms pypy 3.8.13

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 4.py 561ms 0.2ms 8.7MB 543ms 3ms pyston 3.8.12
python 4.py 562ms 1.3ms 8.3MB 550ms 0ms cpython 3.10.5
python 4.py 656ms 9.3ms 79.9MB 613ms 30ms pypy 3.8.13

regex-redux

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 3331ms 3.7ms 277.1MB 3197ms 117ms pypy 3.8.13
python 1.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.5
python 1.py timeout 0.0ms 0.0MB 0ms 0ms pyston 3.8.12

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 458ms 1.4ms 97.5MB 413ms 27ms pypy 3.8.13
python 1.py 709ms 2.1ms 30.6MB 667ms 27ms pyston 3.8.12
python 1.py 781ms 1.3ms 30.9MB 750ms 13ms cpython 3.10.5

secp256k1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 4444ms 17ms 8.4MB 4423ms 3ms pyston 3.8.12
python 1.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.5
python 1.py timeout 0.0ms 0.0MB 0ms 0ms pypy 3.8.13

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 1125ms 0.8ms 8.3MB 1110ms 0ms pyston 3.8.12
python 1.py 1468ms 6.3ms 7.4MB 1450ms 0ms cpython 3.10.5
python 1.py 1522ms 0.2ms 80.2MB 1487ms 17ms pypy 3.8.13

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.5
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.5
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 3824ms 41ms 107.8MB 6557ms 443ms pypy 3.8.13
perl 4-m.pl 4806ms 19ms 8.6MB 9333ms 10ms perl 5.36.0
python 8.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.5
python 8.py timeout 0.0ms 0.0MB 0ms 0ms pyston 3.8.12