Swift VS Kotlin benchmarks

Current benchmark data was generated on Wed Feb 08 2023, full log can be found HERE

CONTRIBUTIONS are WELCOME!

[x86_64][2 cores] Intel(R) Xeon(R) Platinum 8171M CPU @ 2.60GHz (Model 85)

* -m in a file name stands for multi-threading or multi-processing

* -i in a file name stands for direct intrinsics usage. (Usage of simd intrinsics via libraries is not counted)

* -ffi in a file name stands for non-stdlib FFI usage

* (You may find time < time(user) + time(sys) for some non-parallelized programs, the overhead is from GC or JIT compiler, which are allowed to take advantage of multi-cores as that's more close to real-world scenarios.)

fannkuch-redux

Input: 11

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 1.swift 3536ms 37ms 2.4MB 3527ms 0ms swift 5.7.3

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 1.swift 293ms 2.8ms 5.2MB 283ms 0ms swift 5.7.3

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 3.swift 474ms 12ms 21.1MB 630ms 10ms swift 5.7.3

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 3.swift 74ms 2.7ms 14.7MB 60ms 0ms swift 5.7.3

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt 2.6ms 0.4ms 1.5MB 0ms 0ms kotlin/native 1.8.10
swift 1.swift 4.4ms 0.2ms 0.0MB 0ms 0ms swift 5.7.3
kotlin 1.kt 78ms 1.3ms 40.7MB 62ms 10ms kotlin/jvm 17.0.2

knucleotide

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 2-m.swift 2402ms 35ms 44.4MB 4443ms 47ms swift 5.7.3

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 2-m.swift 496ms 97ms 41.4MB 723ms 27ms swift 5.7.3

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 7.swift 565ms 41ms 5.1MB 553ms 0ms swift 5.7.3
kotlin 1.kt 768ms 9.5ms 42.9MB 757ms 27ms kotlin/jvm 17.0.2
kotlin 1n.kt 837ms 45ms 1.5MB 827ms 0ms kotlin/native 1.8.10

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 7.swift 58ms 2.1ms 5.1MB 47ms 0ms swift 5.7.3
kotlin 1n.kt 88ms 3.6ms 1.5MB 80ms 0ms kotlin/native 1.8.10
kotlin 1.kt 185ms 11ms 43.0MB 183ms 20ms kotlin/jvm 17.0.2

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt timeout 0.0ms 204.7MB 5390ms 100ms kotlin/jvm 17.0.2
kotlin 1n.kt timeout 0.0ms 14.9MB 6577ms 220ms kotlin/native 1.8.10
kotlin 2n.kt timeout 0.0ms 8.4MB 5067ms 107ms kotlin/native 1.8.10
swift 1.swift timeout 0.0ms 6.3MB 4967ms 10ms swift 5.7.3

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
kotlin 1.kt 1691ms 16ms 244.6MB 2053ms 87ms kotlin/jvm 17.0.2
swift 1.swift 3180ms 62ms 6.2MB 3163ms 0ms swift 5.7.3
kotlin 1n.kt timeout 0.0ms 22.9MB 6607ms 190ms kotlin/native 1.8.10
kotlin 2n.kt timeout 0.0ms 10.4MB 5077ms 100ms kotlin/native 1.8.10