The Computer Language
Benchmarks Game

Rust versus Java 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.

regex-redux
source secs mem gz busy cpu load
Rust 2.12 153,104 986 3.14 17% 14% 33% 84%
Java 10.31 644,560 740 31.47 72% 72% 92% 70%
mandelbrot
source secs mem gz busy cpu load
Rust 1.70 30,544 1332 6.69 98% 98% 99% 98%
Java 6.83 79,108 796 26.86 97% 99% 99% 99%
n-body
source secs mem gz busy cpu load
Rust 6.07 940 1753 6.16 100% 1% 0% 0%
Java 21.93 35,408 1429 22.44 1% 0% 100% 1%
binary-trees
source secs mem gz busy cpu load
Rust 3.31 199,852 721 12.01 88% 88% 87% 100%
Java 8.32 953,620 835 28.37 95% 87% 81% 77%
spectral-norm
source secs mem gz busy cpu load
Rust 1.98 2,244 1126 7.89 99% 100% 99% 99%
Java 4.22 36,948 950 16.43 98% 97% 98% 96%
reverse-complement
source secs mem gz busy cpu load
Rust 1.69 994,564 1330 2.98 45% 26% 47% 59%
Java 3.16 712,368 2183 7.08 65% 47% 42% 70%
pidigits
source secs mem gz busy cpu load
Rust 1.75 3,036 1366 1.77 100% 0% 1% 1%
Java 3.07 39,320 938 3.31 2% 5% 3% 98%
k-nucleotide
source secs mem gz busy cpu load
Rust 5.38 135,192 1749 17.05 64% 73% 89% 91%
Java 9.33 447,976 1812 29.36 73% 83% 82% 77%
fasta
source secs mem gz busy cpu load
Rust 1.51 2,044 1906 4.60 74% 73% 82% 75%
Java 2.22 45,172 2473 5.99 61% 50% 98% 60%
fannkuch-redux
source secs mem gz busy cpu load
Rust 11.08 944 1016 43.52 100% 94% 100% 99%
Java 14.33 34,888 1282 56.56 99% 98% 99% 98%
Rust

rustc 1.40.0 (73528e339 2019-12-16)
LLVM version: 9.0

Java

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