The Computer Language
Benchmarks Game

Java versus C gcc fastest programs

Always look at the source code.

These are only the fastest programs. Look at the other programs. They may seem more-like a fair comparison to you.

fasta
source secs mem gz busy cpu load
Java 2.22 45,172 2473 5.99 61% 50% 98% 60%
C gcc 1.46 2,976 2268 5.82 99% 100% 99% 99%
fannkuch-redux
source secs mem gz busy cpu load
Java 14.33 34,888 1282 56.56 99% 98% 99% 98%
C gcc 8.74 936 910 34.47 100% 95% 100% 100%
reverse-complement
source secs mem gz busy cpu load
Java 3.16 712,368 2183 7.08 65% 47% 42% 70%
C gcc 1.91 532,932 820 2.59 21% 16% 99% 0%
pidigits
source secs mem gz busy cpu load
Java 3.07 39,320 938 3.31 2% 5% 3% 98%
C gcc 1.75 2,804 452 1.77 0% 100% 0% 1%
k-nucleotide
source secs mem gz busy cpu load
Java 9.33 447,976 1812 29.36 73% 83% 82% 77%
C gcc 5.09 130,092 1506 16.69 100% 86% 60% 82%
spectral-norm
source secs mem gz busy cpu load
Java 4.22 36,948 950 16.43 98% 97% 98% 96%
C gcc 1.98 1,236 569 7.87 99% 99% 99% 99%
binary-trees
source secs mem gz busy cpu load
Java 8.32 953,620 835 28.37 95% 87% 81% 77%
C gcc 3.53 168,764 809 11.64 74% 99% 72% 85%
n-body
source secs mem gz busy cpu load
Java 21.93 35,408 1429 22.44 1% 0% 100% 1%
C gcc 7.30 8 1391 7.33 0% 0% 1% 100%
mandelbrot
source secs mem gz busy cpu load
Java 6.83 79,108 796 26.86 97% 99% 99% 99%
C gcc 1.64 27,016 1135 6.54 100% 99% 100% 100%
regex-redux
source secs mem gz busy cpu load
Java 10.31 644,560 740 31.47 72% 72% 92% 70%
C gcc 1.47 152,156 1397 3.46 47% 100% 43% 45%
Java

openjdk 13 2019-09-17
OpenJDK Runtime Environment (build 13+33)
OpenJDK 64-Bit Server VM (build 13+33, mixed mode, sharing)

C gcc

gcc (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008