Swift VS Nim benchmarks

Current benchmark data was generated on Sat Jan 28 2023, full log can be found HERE

CONTRIBUTIONS are WELCOME!

[x86_64][2 cores] Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz (Model 106)

* -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 3393ms 14ms 2.4MB 3377ms 0ms swift 5.7.3

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 1.swift 285ms 0.5ms 5.3MB 273ms 0ms swift 5.7.3

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 2.nim 268ms 0.2ms 1.0MB 260ms 0ms nim 1.6.10
nim 2.nim 335ms 0.2ms 1.3MB 327ms 0ms nim/clang 1.6.10
swift 3-m.swift 390ms 3.2ms 20.9MB 687ms 10ms swift 5.7.3
nim 1.nim 779ms 4.3ms 1.1MB 687ms 73ms nim 1.6.10
nim 1.nim 796ms 1.3ms 1.2MB 687ms 93ms nim/clang 1.6.10

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 2.nim 32ms 3.0ms 1.1MB 20ms 0ms nim 1.6.10
nim 2.nim 37ms 2.3ms 1.3MB 27ms 0ms nim/clang 1.6.10
swift 3.swift 58ms 0.9ms 14.6MB 53ms 3ms swift 5.7.3
nim 1.nim 79ms 0.1ms 1.1MB 57ms 7ms nim 1.6.10
nim 1.nim 83ms 1.7ms 1.3MB 67ms 3ms nim/clang 1.6.10

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 1.nim 1.5ms 0.8ms 1.3MB 0ms 0ms nim/clang 1.6.10
nim 1.nim 1.7ms 0.7ms 1.0MB 0ms 0ms nim 1.6.10
swift 1.swift 1.8ms 0.1ms 2.3MB 0ms 0ms swift 5.7.3

knucleotide

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 2-m.swift 2299ms 268ms 42.5MB 4253ms 23ms 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 381ms 27ms 33.6MB 643ms 13ms swift 5.7.3

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 2.nim 381ms 0.4ms 1.3MB 370ms 0ms nim 1.6.10
nim 2.nim 412ms 3.2ms 1.3MB 403ms 0ms nim/clang 1.6.10
swift 7.swift 426ms 0.2ms 5.1MB 410ms 0ms swift 5.7.3

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 2.nim 40ms 0.0ms 1.4MB 30ms 0ms nim 1.6.10
nim 2.nim 43ms 0.2ms 1.2MB 30ms 0ms nim/clang 1.6.10
swift 7.swift 45ms 0.5ms 5.1MB 37ms 0ms swift 5.7.3

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
nim 1.nim timeout 0.0ms 5.9MB 4987ms 0ms nim 1.6.10
nim 1.nim timeout 0.0ms 6.1MB 4987ms 0ms nim/clang 1.6.10
swift 1.swift timeout 0.0ms 6.4MB 4953ms 13ms swift 5.7.3

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 1.swift 2571ms 3.4ms 6.2MB 2553ms 3ms swift 5.7.3
nim 1.nim timeout 0.0ms 5.9MB 4987ms 0ms nim 1.6.10
nim 1.nim timeout 0.0ms 6.1MB 4990ms 0ms nim/clang 1.6.10