The Computer Language
Benchmarks Game

Java programs versus C gcc

by benchmark task performance

mandelbrot
source secs KB gz cpu cpu load
Java 7.14 88,236 796 27.93 97% 98% 98% 99%
C gcc 5.92 32,572 694 22.78 95% 95% 95% 100%
k-nucleotide
source secs KB gz cpu cpu load
Java 8.10 469,624 1802 25.75 97% 77% 76% 71%
C gcc 6.46 130,076 1500 17.06 51% 37% 89% 88%
fasta
source secs KB gz cpu cpu load
Java 2.20 37,072 2457 6.37 81% 68% 72% 72%
C gcc 1.36 2,800 1993 5.26 96% 97% 100% 97%
fasta-redux
source secs KB gz cpu cpu load
Java 2.53 31,648 1443 2.59 3% 98% 1% 3%
C gcc 1.55 780 1321 1.55 0% 100% 2% 1%
pidigits
source secs KB gz cpu cpu load
Java 3.11 33,364 938 3.20 99% 2% 2% 2%
C gcc 1.73 1,992 448 1.73 1% 100% 1% 0%
regex-dna
source secs KB gz cpu cpu load
Java 4.56 667,820 1085 12.16 60% 66% 56% 87%
C gcc 2.43 339,000 2579 5.68 46% 70% 51% 72%
fannkuch-redux
source secs KB gz cpu cpu load
Java 17.34 30,084 1282 68.20 97% 98% 99% 99%
C gcc 9.07 1,576 910 35.43 100% 99% 98% 94%
spectral-norm
source secs KB gz cpu cpu load
Java 4.26 32,244 950 16.41 96% 98% 95% 97%
C gcc 1.98 1,776 1139 7.87 99% 99% 100% 99%
n-body
source secs KB gz cpu cpu load
Java 22.53 28,212 1430 22.54 100% 7% 1% 1%
C gcc 9.56 1,000 1490 9.56 1% 100% 1% 1%
reverse-complement
source secs KB gz cpu cpu load
Java 1.17 345,940 1661 2.42 41% 43% 57% 72%
C gcc 0.42 145,900 812 0.57 0% 26% 20% 100%
binary-trees
source secs KB gz cpu cpu load
Java 11.51 622,328 889 40.10 86% 86% 92% 87%
C gcc 3.28 156,780 906 10.12 91% 77% 59% 83%
Java

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

C gcc

gcc (Ubuntu 5.4.0-6ubuntu1~16.04.1) 5.4.0 20160609