The Computer Language
Benchmarks Game

Java programs versus C gcc

by benchmark task performance

binary-trees
source secs KB gz cpu cpu load
Java 7.39 414,024 583 7.38 1% 1% 1% 100%
C gcc 9.28 150,364 906 9.26 0% 0% 1% 100%
k-nucleotide
source secs KB gz cpu cpu load
Java 34.83 1,124,104 1844 34.79 1% 1% 0% 100%
C gcc 32.04 181,108 2280 32.01 1% 0% 0% 100%
mandelbrot
source secs KB gz cpu cpu load
Java 23.93 91,684 796 23.92 1% 1% 1% 100%
C gcc 19.75 32,496 694 19.74 0% 0% 0% 100%
fasta
source secs KB gz cpu cpu load
Java 5.15 31,376 1507 5.14 1% 1% 0% 100%
C gcc 3.29 748 1261 3.29 0% 0% 1% 100%
pidigits
source secs KB gz cpu cpu load
Java 3.20 33,052 938 3.20 1% 1% 1% 100%
C gcc 1.73 2,072 448 1.72 1% 1% 0% 100%
spectral-norm
source secs KB gz cpu cpu load
Java 16.22 32,332 950 16.22 0% 1% 1% 100%
C gcc 7.85 1,692 569 7.85 0% 1% 0% 100%
n-body
source secs KB gz cpu cpu load
Java 22.68 30,056 1424 22.67 0% 0% 1% 100%
C gcc 10.50 1,008 1490 10.49 0% 1% 1% 100%
reverse-complement
source secs KB gz cpu cpu load
Java 1.70 474,400 745 1.70 1% 1% 3% 99%
C gcc 0.67 251,684 741 0.66 0% 1% 0% 100%
fannkuch-redux
source secs KB gz cpu cpu load
Java 69.27 47,784 1282 69.25 1% 0% 0% 100%
C gcc 22.63 808 1183 22.62 1% 2% 1% 100%
regex-dna
source secs KB gz cpu cpu load
Java 21.40 575,372 1284 21.39 1% 0% 1% 100%
C gcc 5.09 323,572 2579 5.08 0% 1% 0% 100%
Java

java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

C gcc

gcc version 4.9.2 (Ubuntu 4.9.2-10ubuntu13)