The Computer Language
Benchmarks Game

Java programs versus C++ g++

by benchmark task performance

fasta
source secs mem gz cpu cpu load
Java 4.77 23,400 1507 4.76 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
Java 27.41 55,556 796 27.40 1% 0% 1% 100%
C++ g++ 20.11 33,768 726 20.10 0% 1% 1% 100%
k-nucleotide
source secs mem gz cpu cpu load
Java 36.57 512,948 1802 36.54 1% 0% 0% 100%
C++ g++ 24.04 137,908 1252 23.98 1% 1% 0% 100%
reverse-complement
source secs mem gz cpu cpu load
Java 1.79 521,988 745 1.78 1% 2% 2% 100%
C++ g++ 1.02 247,604 2275 1.01 2% 0% 0% 100%
pidigits
source secs mem gz cpu cpu load
Java 4.14 25,988 938 4.13 1% 1% 0% 100%
C++ g++ 2.27 3,440 508 2.27 0% 1% 1% 100%
spectral-norm
source secs mem gz cpu cpu load
Java 16.30 23,872 950 16.29 1% 0% 1% 100%
C++ g++ 7.93 2,288 1044 7.92 1% 1% 0% 100%
binary-trees
source secs mem gz cpu cpu load
Java 16.53 511,692 584 16.51 1% 1% 0% 100%
C++ g++ 6.86 76,616 846 6.85 0% 1% 0% 100%
n-body
source secs mem gz cpu cpu load
Java 24.07 23,184 1430 24.06 1% 1% 1% 100%
C++ g++ 8.96 816 1545 8.95 1% 1% 0% 100%
fannkuch-redux
source secs mem gz cpu cpu load
Java 67.02 23,380 1257 67.00 0% 1% 1% 100%
C++ g++ 24.65 556 1150 24.64 1% 1% 0% 100%
Java

java version "1.8.0_92"
Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
Java HotSpot(TM) Server VM (build 25.92-b14, mixed mode)

C++ g++

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