The Computer Language
22.05 Benchmarks Game

Fastest cpu secs Java versus C gcc

Always look at the source code.

If the fastest programs are hand-written vector instructions, does the host language matter? You might be more interested in the less optimised programs — more cpu seconds, less gz source code.

fannkuch-redux
source mem gz cpu
C gcc #6 1,044 1576 8.26
C gcc #4 964 1183 13.89
C gcc #5 1,072 910 29.38
Java #3 35,324 1257 41.17
Java 35,824 1282 41.74
C gcc #3 1,016 567 42.18
C gcc 988 508 43.27
Java #2 34,244 514 44.98
C gcc #2 1,140 1557 45.01
n-body
source mem gz cpu
C gcc #9 992 1633 2.12
C gcc #8 8 1391 4.10
C gcc #4 1,304 1490 4.44
C gcc #5 1,020 1429 6.10
Java #5 34,252 1429 6.79
Java #4 34,076 1489 6.79
C gcc #7 1,300 1244 6.79
C gcc #2 1,264 1263 7.19
C gcc #6 1,304 1180 7.21
C gcc #3 1,304 1208 7.23
Java #3 34,612 1430 7.50
Java #2 34,704 1424 7.50
C gcc 1,264 1173 7.55
Java 37,380 1430 7.83
spectral-norm
source mem gz cpu
C gcc #6 1,068 1197 1.57
C gcc #5 1,344 569 2.85
C gcc #4 1,352 1139 2.85
C gcc 1,248 383 5.38
C gcc #3 1,348 463 5.68
Java #3 38,428 756 5.94
Java 37,288 514 9.76
Java #2 37,368 950 10.07
mandelbrot
source mem gz cpu
C gcc #6 31,244 1135 5.12
C gcc #8 33,068 782 6.29
C gcc #4 32,704 799 13.81
C gcc #7 33,108 994 13.87
C gcc 29,692 822 13.91
C gcc #3 29,840 763 13.99
C gcc #9 32,904 694 16.03
Java #4 66,304 660 16.16
Java #2 68,860 796 16.21
Java #6 67,432 802 16.92
C gcc #2 1,040 400 25.30
Java 34,252 665 27.75
Java #3 69,200 903 29.18
pidigits
source mem gz cpu
C gcc 2,648 452 0.73
C gcc #2 2,920 416 0.74
Java #3 35,700 764 0.82
Java #2 38,328 938 1.53
Java 513,728 800 8.94
regex-redux
source mem gz cpu
C gcc #5 152,220 1397 2.02
C gcc #2 103,084 1115 3.23
C gcc #4 152,056 1230 3.24
C gcc #3 103,540 1266 3.31
Java 924,116 868 17.12
Java #6 728,332 740 17.16
Java #3 741,028 929 17.34
fasta
source mem gz cpu
C gcc #9 1,256 1463 0.78
C gcc #5 1,052 1281 1.30
C gcc #8 1,044 1293 2.74
C gcc #6 2,140 1930 2.76
C gcc #4 1,020 1240 3.06
C gcc #2 2,860 2268 3.25
C gcc #7 2,864 2011 3.28
Java #4 36,800 1524 3.41
Java #6 42,416 2543 3.52
C gcc 1,016 1206 3.67
Java #5 42,532 2473 4.14
Java #2 36,812 1257 4.46
C gcc #3 972 819 4.49
k-nucleotide
source mem gz cpu
C gcc 130,156 1506 12.31
Java 349,544 1812 16.17
Java #6 343,684 1607 25.67
Java #3 344,652 1635 25.73
Java #4 199,824 1882 37.48
Java #5 210,368 2219 43.27
reverse-complement
source mem gz cpu
C gcc #7 499,132 1965 0.57
C gcc #8 499,184 1627 0.77
C gcc #6 688,416 820 1.27
C gcc #5 994,088 647 1.42
C gcc #2 994,152 750 1.45
C gcc #4 500,416 709 3.49
Java #8 665,804 2183 3.49
Java #6 2,024,016 752 4.15
Java #5 1,088,392 1108 4.92
Java #3 1,170,232 1722 5.09
Java #4 1,881,900 651 5.41
Java #7 1,030,892 1647 23.16
binary-trees
source mem gz cpu
C gcc #2 168,384 809 4.32
C gcc #3 134,068 836 4.71
Java #3 2,106,820 540 5.19
Java #6 2,093,916 529 5.35
Java #4 2,079,388 840 5.44
Java #2 1,877,464 552 5.45
Java #7 2,460,388 835 7.73
C gcc 263,664 654 22.16
C gcc #5 351,304 908 32.02
Java

openjdk 18 2022-03-22
OpenJDK Runtime Environment
(build 18+36-2087)
OpenJDK 64-Bit Server VM
(build 18+36-2087,
mixed mode, sharing)

C gcc

11.2.0-19ubuntu1