The Computer Language
Benchmarks Game

Lua 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.

n-body
source secs mem gz busy cpu load
Lua 406.77 1,368 1305 412.06 0% 0% 1% 100%
Java 21.93 35,408 1429 22.44 1% 0% 100% 1%
k-nucleotide
source secs mem gz busy cpu load
Lua 189.90 521,716 613 191.07 1% 0% 99% 1%
Java 9.33 447,976 1812 29.36 73% 83% 82% 77%
fasta
source secs mem gz busy cpu load
Lua 51.34 3,056 1061 51.87 0% 0% 1% 100%
Java 2.22 45,172 2473 5.99 61% 50% 98% 60%
reverse-complement
source secs mem gz busy cpu load
Lua 77.65 2,932,848 553 77.85 26% 1% 4% 69%
Java 3.16 712,368 2183 7.08 65% 47% 42% 70%
mandelbrot
source secs mem gz busy cpu load
Lua 256.77 22,712 623 899.10 99% 86% 87% 78%
Java 6.83 79,108 796 26.86 97% 99% 99% 99%
spectral-norm
source secs mem gz busy cpu load
Lua 192.80 2,872 329 199.44 15% 85% 1% 2%
Java 4.22 36,948 950 16.43 98% 97% 98% 96%
binary-trees
source secs mem gz busy cpu load
Lua 468.44 2,358,616 412 477.98 1% 1% 100% 0%
Java 8.32 953,620 835 28.37 95% 87% 81% 77%
fannkuch-redux
source secs mem gz busy cpu load
Lua 1,317.39 1,340 462 1,339.50 0% 100% 1% 1%
Java 14.33 34,888 1282 56.56 99% 98% 99% 98%
regex-redux
source secs mem gz busy cpu load
Lua   Bad Output
Java 10.31 644,560 740 31.47 72% 72% 92% 70%
pidigits
source secs mem gz busy cpu load
Lua   Failed
Java 3.07 39,320 938 3.31 2% 5% 3% 98%
Lua

Lua 5.3.5 Copyright (C) 1994-2018 Lua.org, PUC-Rio

Java

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