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.47 10,364 386 3.47 0% 1% 100% 0%
C++ g++ 1.89 4,380 513 1.88 2% 99% 4% 2%
reverse-complement
source secs mem gz cpu cpu load
Python 3 16.03 1,007,016 814 19.29 18% 59% 44% 23%
C++ g++ 2.93 980,716 2280 4.52 51% 23% 33% 51%
regex-redux
source secs mem gz cpu cpu load
Python 3 16.98 445,760 512 31.44 28% 74% 47% 38%
C++ g++ 1.83 203,520 1315 4.41 50% 45% 100% 49%
k-nucleotide
source secs mem gz cpu cpu load
Python 3 72.80 189,720 1967 276.09 95% 96% 98% 94%
C++ g++ 3.73 156,080 1624 11.60 75% 70% 72% 96%
binary-trees
source secs mem gz cpu cpu load
Python 3 83.95 451,732 589 290.57 88% 87% 87% 97%
C++ g++ 3.68 119,052 809 11.93 98% 76% 77% 78%
fasta
source secs mem gz cpu cpu load
Python 3 63.19 680,688 1947 135.52 62% 70% 63% 22%
C++ g++ 1.33 1,740 2711 4.29 81% 81% 81% 82%
fannkuch-redux
source secs mem gz cpu cpu load
Python 3 507.56 50,988 950 1,998.88 99% 99% 97% 99%
C++ g++ 10.12 1,852 980 39.95 100% 100% 96% 100%
n-body
source secs mem gz cpu cpu load
Python 3 850.24 7,916 1242 850.06 0% 0% 0% 100%
C++ g++ 9.42 1,704 1763 9.41 2% 100% 1% 0%
spectral-norm
source secs mem gz cpu cpu load
Python 3 182.12 52,752 443 705.87 96% 96% 96% 100%
C++ g++ 1.98 1,164 1044 7.87 99% 99% 99% 100%
mandelbrot
source secs mem gz cpu cpu load
Python 3 263.04 51,780 688 1,050.80 100% 100% 100% 100%
C++ g++ 1.51 25,640 1791 5.99 100% 100% 99% 99%
Python 3

Python 3.7.1

C++ g++

g++ (Ubuntu 8.2.0-7ubuntu1) 8.2.0