The Computer Language
Benchmarks Game

Python 3 programs versus C++ g++

by benchmark task performance

pidigits
source secs mem gz cpu cpu load
Python 3 4.47 8,308 382 4.46 0% 36% 63% 100%
C++ g++ 2.27 3,440 508 2.27 0% 1% 1% 100%
reverse-complement
source secs mem gz cpu cpu load
Python 3 5.54 262,360 800 5.53 1% 1% 1% 100%
C++ g++ 1.02 247,604 2275 1.01 2% 0% 0% 100%
k-nucleotide
source secs mem gz cpu cpu load
Python 3 317.42 219,028 1937 317.16 0% 1% 1% 100%
C++ g++ 24.04 137,908 1252 23.98 1% 1% 0% 100%
fasta
source secs mem gz cpu cpu load
Python 3 122.25 6,508 977 122.19 1% 1% 1% 100%
C++ g++ 4.21 1,336 1105 4.20 1% 1% 0% 100%
mandelbrot
source secs mem gz cpu cpu load
Python 3 1,209.01 40,500 686 1,208.52 1% 0% 1% 100%
C++ g++ 20.11 33,768 726 20.10 0% 1% 1% 100%
binary-trees
source secs mem gz cpu cpu load
Python 3 497.80 482,656 596 497.40 1% 1% 1% 100%
C++ g++ 6.86 76,616 846 6.85 0% 1% 0% 100%
fannkuch-redux
source secs mem gz cpu cpu load
Python 3 2,464.08 44,564 944 2,463.20 1% 0% 0% 100%
C++ g++ 24.65 556 1150 24.64 1% 1% 0% 100%
n-body
source secs mem gz cpu cpu load
Python 3 1,024.87 6,324 1228 1,024.54 1% 0% 1% 100%
C++ g++ 8.96 816 1545 8.95 1% 1% 0% 100%
spectral-norm
source secs mem gz cpu cpu load
Python 3 1,105.41 7,120 328 1,105.02 1% 0% 0% 100%
C++ g++ 7.93 2,288 1044 7.92 1% 1% 0% 100%
Python 3

Python 3.5.0 (default, Sep 14 2015, 09:36:50) [GCC 4.9.2] on linux

C++ g++

g++ (Ubuntu 5.4.0-6ubuntu1~16.04.1) 5.4.0 20160609