The Computer Language
24.09 Benchmarks Game

Java versus Node.js fastest performance

How the programs are written matters! 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 seconds, less gz source code.

fannkuch-redux
source secs mem gz cpu secs
Java 10.04 42,708 1289 39.47
Java #3 40.81 42,920 1264 40.91
Java #2 44.33 41,012 520 44.38
Node.js #5 11.47 94,880 1320 45.57
n-body
source secs mem gz cpu secs
Java #5 6.79 41,476 1435 6.83
Java #4 6.91 41,364 1495 6.95
Java #2 7.58 41,440 1430 7.62
Java #3 7.63 41,352 1436 7.67
Java 7.89 41,616 1437 7.93
Node.js #6 8.63 52,224 1274 8.63
spectral-norm
source secs mem gz cpu secs
Node.js #7 5.36 51,956 420 5.37
Node.js 5.37 52,464 326 5.39
Node.js #6 1.57 102,656 1002 5.99
Java #3 1.69 43,028 762 6.41
Java 7.08 42,384 521 7.14
Java #2 2.44 42,180 956 9.47
mandelbrot
source secs mem gz cpu secs
Node.js #3 4.02 132,224 1128 15.91
Java #2 4.14 81,668 802 16.25
Java #4 4.44 104,696 667 16.25
Java #6 4.31 81,888 808 16.97
Java 25.75 41,428 671 25.81
Java #3 7.42 81,216 910 29.33
Node.js #2 29.58 59,472 422 29.61
Node.js 64.37 54,416 380 64.48
pidigits
source secs mem gz cpu secs
Java #3 0.94 40,944 770 0.96
Node.js #4 1.08 57,404 487 1.11
Java #2 1.35 44,528 944 1.42
Java 7.63 491,600 807 8.66
Node.js #2 12.35 85,896 405 12.38
Node.js #3 12.48 85,704 431 12.51
regex-redux
source secs mem gz cpu secs
Java #8 1.62 372,312 2201 3.20
Node.js #3 4.31 799,680 675 5.34
Node.js #4 5.54 966,596 471 5.68
Java 8.58 586,528 875 16.95
Java #6 5.59 1,235,356 746 17.14
Java #3 5.25 629,428 935 17.37
fasta
source secs mem gz cpu secs
Java #4 3.16 42,812 1528 3.27
Java #6 1.18 48,364 2549 3.74
Java #5 1.26 48,824 2478 4.17
Java #2 4.39 47,624 1259 4.56
Node.js #5 2.49 106,400 2050 6.99
Node.js 38.06 57,560 815 38.45
k-nucleotide
source secs mem gz cpu secs
Java 5.02 369,032 1821 16.31
Java #3 7.26 365,384 1642 25.09
Java #6 7.26 365,680 1614 25.28
Java #4 34.70 195,564 1887 35.08
Java #5 20.44 218,932 2225 44.56
Node.js #3 16.35 429,444 1817 44.67
Node.js #2 36.18 485,300 941 111.06
Node.js 37.58 351,188 1011 114.02
reverse-complement
source secs mem gz cpu secs
Java #6 3.40 2,031,576 760 4.06
Java #5 4.78 1,096,264 1115 4.92
Java #4 5.59 1,890,020 656 5.71
Java #7 23.61 1,036,152 1654 6.24
Node.js #2 15.71 728,180 1228 16.37
Node.js #7   Bad Output  
Java #3   Bad Output  
Java #8   Bad Output  
binary-trees
source secs mem gz cpu secs
Java #4 4.46 1,957,564 846 5.19
Java #3 4.90 2,032,184 546 5.67
Java #6 5.02 2,065,280 535 5.79
Java #2 5.11 2,064,188 558 5.83
Java #7 2.59 1,718,620 841 8.08
Node.js #7 17.30 1,067,648 458 29.17
Node.js #6 9.07 1,348,960 752 31.26
Node.js 8.91 1,393,184 717 33.54
Java

java 22 2024-03-19
Java HotSpot(TM) 64-Bit Server VM
(build 22+36-2370,
mixed mode, sharing)

Node.js

v22.8.0