The Computer Language
Benchmarks Game

Python 3 versus C++ g++ fastest programs

by faster benchmark performance

pidigits
source secs mem gz cpu cpu load
Python 3 3.51 10,500 386 3.50 1% 1% 0% 100%
C++ g++ 1.89 4,284 513 1.88 5% 0% 1% 100%
reverse-complement
source secs mem gz cpu cpu load
Python 3 16.76 1,005,252 814 20.08 65% 21% 44% 17%
C++ g++ 2.95 980,472 2280 4.56 50% 41% 16% 50%
regex-redux
source secs mem gz cpu cpu load
Python 3 15.56 439,964 512 27.97 25% 92% 32% 32%
C++ g++ 1.66 203,568 1315 4.23 48% 53% 57% 99%
k-nucleotide
source secs mem gz cpu cpu load
Python 3 79.79 250,948 1967 309.42 98% 96% 96% 99%
C++ g++ 3.66 155,956 1624 11.16 70% 98% 70% 68%
binary-trees
source secs mem gz cpu cpu load
Python 3 93.40 449,328 589 336.54 88% 92% 94% 89%
C++ g++ 2.62 130,212 809 7.92 76% 67% 63% 99%
fasta
source secs mem gz cpu cpu load
Python 3 62.88 680,736 1947 141.15 60% 56% 48% 62%
C++ g++ 1.33 1,956 2711 4.16 79% 79% 79% 79%
fannkuch-redux
source secs mem gz cpu cpu load
Python 3 547.23 48,052 950 2,162.70 99% 100% 97% 100%
C++ g++ 10.62 2,040 980 41.91 100% 95% 100% 100%
spectral-norm
source secs mem gz cpu cpu load
Python 3 193.86 50,556 443 757.23 98% 98% 99% 99%
C++ g++ 1.98 1,340 1044 7.87 99% 100% 99% 99%
n-body
source secs mem gz cpu cpu load
Python 3 882.00 8,212 1196 881.81 91% 0% 1% 9%
C++ g++ 8.24 1,924 1763 8.23 1% 0% 100% 1%
mandelbrot
source secs mem gz cpu cpu load
Python 3 279.68 49,344 688 1,117.29 100% 100% 100% 100%
C++ g++ 1.51 25,588 1791 5.99 99% 99% 99% 99%
Python 3

Python 3.7.0

C++ g++

g++ (Ubuntu 7.3.0-16ubuntu3) 7.3.0