The Computer Language
Benchmarks Game

Python 3 programs versus C++ g++

by benchmark task performance

regex-redux
source secs mem gz cpu cpu load
Python 3 14.86 439,208 486 27.92 46% 77% 35% 31%
C++ g++ 17.14 220,088 853 25.22 95% 3% 51% 1%
reverse-complement
source secs mem gz cpu cpu load
Python 3 2.82 265,428 800 4.18 46% 32% 20% 54%
C++ g++ 0.60 211,852 2275 0.98 38% 25% 82% 27%
k-nucleotide
source secs mem gz cpu cpu load
Python 3 84.73 221,028 1937 276.97 97% 93% 91% 91%
C++ g++ 7.18 164,052 1252 24.28 83% 83% 93% 83%
binary-trees
source secs mem gz cpu cpu load
Python 3 86.90 451,548 581 306.31 89% 97% 87% 89%
C++ g++ 2.36 114,404 809 7.69 86% 71% 87% 85%
fannkuch-redux
source secs mem gz cpu cpu load
Python 3 483.79 51,896 944 1,880.10 97% 94% 100% 99%
C++ g++ 10.35 2,624 980 40.60 99% 99% 100% 95%
fasta
source secs mem gz cpu cpu load
Python 3 110.91 8,024 977 110.87 100% 1% 1% 1%
C++ g++ 1.48 4,176 2313 5.25 89% 90% 88% 89%
n-body
source secs mem gz cpu cpu load
Python 3 787.02 7,744 1181 786.82 0% 1% 0% 100%
C++ g++ 9.31 1,052 1544 9.30 1% 1% 1% 100%
spectral-norm
source secs mem gz cpu cpu load
Python 3 188.83 54,524 437 750.46 99% 100% 100% 99%
C++ g++ 1.99 1,880 1044 7.89 100% 99% 99% 99%
mandelbrot
source secs mem gz cpu cpu load
Python 3 273.43 53,416 686 1,091.35 100% 100% 100% 100%
C++ g++ 1.73 34,064 1002 6.80 98% 98% 98% 99%
pidigits
source secs mem gz cpu cpu load
Python 3   Failed
C++ g++ 0.07 ? 508 0.07 0% 0% 89% 0%
Python 3

Python 3.6.1 (default, Apr 18 2017, 10:33:41)
[GCC 6.3.0 20170406]
--enable-optimizations --with-lto
make profile-opt

C++ g++

g++ (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406