Python Interpreters Benchmarks
x64 ArchLinux : AMD® Ryzen 7 4700U®

vs

 1 : Are the Python 2 programs faster? At a glance.

Each chart bar shows, for one unidentified benchmark, how much the fastest Python 2 program used compared to the fastest Python 3 program.

(Memory use is only compared for tasks that require memory to be allocated.)


These are not the only compilers and interpreters. These are not the only programs that could be written. These are not the only tasks that could be solved. These are just 10 tiny examples.

 2 : Are the Python 2 programs faster? Approximately.

Each table row shows, for one named benchmark, how much the fastest Python 2 program used compared to the fastest Python 3 program.

(Memory use is only compared for tasks that require memory to be allocated.)

 Python 2 used what fraction? used how many times more? 
Benchmark Time Memory Code
 reverse-complement † ?±
 thread-ring †1/146 ±
 regex-dna1/2?±
 pystone †± ±
 meteor-contest †± ±
 fibonacci †± ±
 richards †± ±
 k-nucleotide †±?±
 n-body †± ±
 fib50 †± ±
 fannkuch-redux± ±
 fasta †± 1/2
 jsonbench † ±
 binary-trees10×±
 spectral-norm?
 iobench † ±
 pidigits †101×?±
 Python 2 used what fraction? used how many times more? 
Time-used  |-  |---  25% median  75%  ---|  -|
(Elapsed secs)  ±±101×

† possible mismatch - one-core program compared to multi-core program.

± read the measurements and then read the program source code.

 3 : Are the Python 2 programs faster? Measurements.

These are not the only tasks that could be solved. These are just 10 tiny examples. These are not the only compilers and interpreters. These are not the only programs that could be written.

For each named benchmark, measurements of the fastest Python 2 program are shown for comparison against measurements of the fastest Python 3 program.

Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
 reverse-complement 
Python 20.01?432   †
Python 30.020.02?449  33% 100% 33% 50% 0% 0% 33% 100% †
 thread-ring 
Python 20.380.392,800407  3% 3% 97% 0% 0% 0% 0% 0% †
Python 364.6956.0812,708448  22% 21% 22% 20% 17% 18% 17% 17% †
 regex-dna 
Python 20.030.03?501  100% 0% 0% 0% 0% 0% 0% 33%
Python 30.050.05?524  67% 20% 0% 40% 0% 0% 83% 20%
 pystone 
Python 20.200.20?2301  0% 0% 0% 0% 0% 100% 0% 0% †
Python 30.250.251,6162300  20% 12% 36% 12% 17% 17% 9% 100% †
 meteor-contest 
Python 22.142.146,8281485  0% 0% 100% 0% 0% 0% 0% 1% †
Python 32.602.629,2561443  60% 13% 10% 11% 54% 12% 11% 12% †
 fibonacci 
Python 20.490.496,772181  0% 100% 2% 0% 0% 0% 0% 0% †
Python 30.560.568,584182  12% 50% 17% 5% 54% 7% 11% 2% †
 richards 
Python 20.870.876,3482423  1% 0% 100% 0% 1% 0% 0% 0% †
Python 30.900.908,7282434  19% 18% 18% 14% 100% 13% 12% 15% †
 k-nucleotide 
Python 20.070.07?593  100% 0% 0% 0% 0% 0% 0% 0% †
Python 30.100.07?801  17% 14% 38% 88% 25% 12% 83% 22% †
 n-body 
Python 238.7838.786,6841337  0% 0% 0% 0% 0% 1% 0% 100% †
Python 338.1938.198,0921315  19% 16% 100% 13% 14% 14% 12% 12% †
 fib50 
Python 22.402.4037,872130  0% 0% 100% 0% 0% 0% 0% 0% †
Python 32.132.149,276136  5% 4% 4% 2% 5% 3% 100% 2% †
 fannkuch-redux 
Python 211.022.8511,4601009  6% 4% 97% 95% 94% 0% 1% 96%
Python 314.552.2012,8121069  94% 95% 94% 90% 98% 90% 93% 90%
 fasta 
Python 25.875.9112,988900  0% 0% 1% 0% 0% 99% 0% 0% †
Python 37.494.4412,9362016  24% 55% 29% 21% 18% 71% 16% 18% †
 jsonbench 
Python 24.254.2615,884322  0% 0% 100% 0% 0% 0% 0% 0% †
Python 32.642.6412,316322  100% 4% 3% 2% 4% 4% 6% 1% †
 binary-trees 
Python 22.020.4716,340743  54% 57% 56% 54% 64% 57% 63% 54%
Python 31.460.291,620741  69% 67% 79% 61% 68% 71% 64% 62%
 spectral-norm 
Python 24.231.1311,728595  78% 71% 51% 30% 25% 35% 40% 59%
Python 30.160.16?394  6% 73% 17% 0% 94% 0% 7% 0%
 iobench 
Python 224.8624.866,336370  0% 0% 100% 0% 0% 0% 0% 0% †
Python 33.383.398,140367  51% 26% 22% 19% 76% 17% 18% 16% †
 pidigits 
Python 22.132.137,128322  0% 0% 0% 0% 1% 0% 100% 0% †
Python 30.020.02?379  67% 25% 33% 0% 0% 0% 33% 100% †
 mandelbrot 
No program
Python 392.9312.6961,7403852  96% 99% 98% 99% 99% 96% 98% 98%
 templates 
No program
Python 30.920.9216,376322  17% 14% 14% 13% 12% 99% 6% 13%
 fasta-redux 
No program
Python 30.250.258161115  14% 96% 0% 4% 23% 19% 17% 9%
 chameneos-redux 
No program
Python 3296.43215.338,7281191  19% 14% 14% 13% 14% 15% 14% 14%
 binary-trees-redux
   No programs

† possible mismatch - one-core program compared to multi-core program.

 4 : Are there other Python 2 programs for these benchmarks?

Remember - those are just the fastest Python 2 and Python 3 programs measured on this OS/machine. Check if there are other implementations of these benchmark programs for Python 2.

Maybe one of those other Python 2 programs is fastest on a different OS/machine.

 5 : Are there other faster programs for these benchmarks?

Remember - those are just the fastest Python 2 and Python 3 programs measured on this OS/machine. Check if there are faster implementations of these benchmark programs for other programming languages.

Maybe one of those other programs is fastest on a different OS/machine.

 Python 2 : the old Python 

Revised BSD license

  Home   Conclusions   License   Play