The Computer Language
Benchmarks Game

Swift programs versus Java

by benchmark task performance

binary-trees
source secs mem gz cpu cpu load
Swift 5.55 247,508 1062 16.74 65% 74% 70% 95%
Java 11.52 643,924 889 40.54 89% 92% 85% 89%
mandelbrot
source secs mem gz cpu cpu load
Swift 3.22 40,340 1136 12.76 99% 99% 100% 99%
Java 5.89 89,504 796 23.08 98% 98% 98% 99%
pidigits
source secs mem gz cpu cpu load
Swift 1.75 7,396 601 1.74 1% 1% 100% 0%
Java 3.06 31,088 938 3.16 0% 3% 9% 92%
fannkuch-redux
source secs mem gz cpu cpu load
Swift 11.44 6,900 1102 45.27 100% 100% 98% 98%
Java 17.74 30,048 1282 69.90 98% 98% 100% 99%
reverse-complement
source secs mem gz cpu cpu load
Swift 0.94 285,740 1287 1.12 54% 0% 47% 21%
Java 1.11 345,308 1661 2.44 33% 58% 54% 80%
spectral-norm
source secs mem gz cpu cpu load
Swift 3.97 10,696 601 15.79 100% 100% 100% 100%
Java 4.29 31,428 950 16.56 97% 96% 98% 97%
n-body
source secs mem gz cpu cpu load
Swift 23.59 4,336 1253 23.58 0% 100% 1% 0%
Java 21.50 27,240 1489 21.52 1% 1% 100% 0%
fasta
source secs mem gz cpu cpu load
Swift 2.40 32,536 2096 7.26 78% 81% 72% 73%
Java 2.14 36,192 2457 5.68 71% 58% 62% 77%
k-nucleotide
source secs mem gz cpu cpu load
Swift 20.48 263,288 1366 75.71 91% 99% 91% 91%
Java 8.02 467,004 1802 25.57 76% 98% 73% 74%
regex-redux
source secs mem gz cpu cpu load
Swift 97.48 694,832 671 97.43 1% 100% 0% 1%
Java 12.16 927,212 929 37.28 73% 81% 75% 78%
Swift Swift version 3.1-dev (LLVM a7c680da51, Clang 9772bf511a, Swift 00b540bfbb)
Target: x86_64-unknown-linux-gnu
swift-3.1-DEVELOPMENT-SNAPSHOT-2017-03-13-a-ubuntu16.04
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)