The Computer Language
Benchmarks Game

Swift programs versus Java

by benchmark task performance

binary-trees
source secs mem gz cpu cpu load
Swift 4.90 192,756 997 13.74 99% 60% 62% 62%
Java 11.26 593,156 835 39.02 85% 88% 90% 88%
mandelbrot
source secs mem gz cpu cpu load
Swift 3.32 41,532 1136 13.18 100% 99% 99% 100%
Java 7.10 90,588 796 27.92 99% 99% 98% 98%
pidigits
source secs mem gz cpu cpu load
Swift 1.75 8,636 601 1.75 1% 1% 2% 100%
Java 3.06 31,760 938 3.16 6% 3% 97% 1%
fannkuch-redux
source secs mem gz cpu cpu load
Swift 10.20 9,868 1102 40.42 100% 99% 100% 98%
Java 13.74 30,368 1282 54.12 100% 98% 98% 99%
reverse-complement
source secs mem gz cpu cpu load
Swift 0.85 212,084 1287 1.03 41% 80% 2% 5%
Java 1.10 345,352 1661 2.40 33% 82% 53% 54%
spectral-norm
source secs mem gz cpu cpu load
Swift 3.97 11,760 601 15.82 100% 100% 100% 100%
Java 4.29 29,884 950 16.56 96% 97% 99% 95%
n-body
source secs mem gz cpu cpu load
Swift 21.96 7,436 1253 21.95 0% 1% 1% 100%
Java 21.54 27,092 1489 21.56 1% 1% 100% 1%
fasta
source secs mem gz cpu cpu load
Swift 2.42 34,544 2096 7.70 90% 85% 68% 79%
Java 2.13 36,036 2457 5.66 94% 58% 59% 60%
k-nucleotide
source secs mem gz cpu cpu load
Swift 20.73 244,084 1366 76.60 92% 90% 97% 92%
Java 7.93 465,372 1802 25.11 75% 75% 75% 93%
regex-redux
source secs mem gz cpu cpu load
Swift 83.47 872,904 715 151.55 89% 93% 2% 1%
Java 12.31 902,528 929 38.75 73% 76% 86% 81%
Swift

Swift version 4.0-dev (LLVM a15decabe3, Clang d08a136083, Swift 2edf2b26d0)
Target: x86_64-unknown-linux-gnu

Java

java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)