Swift VS Zig benchmarks

Current benchmark data was generated on Mon Feb 06 2023, full log can be found HERE

CONTRIBUTIONS are WELCOME!

[x86_64][2 cores] Intel(R) Xeon(R) Platinum 8272CL 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
zig 2-m.zig 1177ms 8.3ms 1.1MB 2280ms 0ms zig 0.11.0-dev.1577+11cc1c16f
zig 3-i.zig 1415ms 0.6ms 1.0MB 1403ms 0ms zig 0.11.0-dev.1577+11cc1c16f
zig 2.zig 2392ms 1.1ms 1.0MB 2380ms 0ms zig 0.11.0-dev.1577+11cc1c16f
swift 1.swift 2924ms 4.7ms 2.4MB 2910ms 0ms swift 5.7.3
zig 1.zig 3198ms 2.9ms 1.0MB 3183ms 0ms zig 0.11.0-dev.1577+11cc1c16f

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2-m.zig 112ms 0.5ms 1.0MB 190ms 0ms zig 0.11.0-dev.1577+11cc1c16f
zig 3-i.zig 121ms 0.8ms 0.9MB 110ms 0ms zig 0.11.0-dev.1577+11cc1c16f
zig 2.zig 203ms 0.2ms 1.0MB 190ms 0ms zig 0.11.0-dev.1577+11cc1c16f
swift 1.swift 245ms 1.3ms 2.4MB 230ms 0ms swift 5.7.3
zig 1.zig 262ms 1.1ms 1.0MB 250ms 0ms zig 0.11.0-dev.1577+11cc1c16f

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 136ms 0.7ms 1.0MB 123ms 0ms zig 0.11.0-dev.1577+11cc1c16f
swift 3.swift 405ms 28ms 22.7MB 537ms 10ms swift 5.7.3

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 16ms 0.5ms 0.9MB 10ms 0ms zig 0.11.0-dev.1577+11cc1c16f
swift 3.swift 65ms 1.8ms 14.7MB 40ms 7ms swift 5.7.3

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 1.5ms 0.7ms 0.9MB 0ms 0ms zig 0.11.0-dev.1577+11cc1c16f
swift 1.swift 3.4ms 0.1ms 0.0MB 0ms 0ms swift 5.7.3

knucleotide

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 1090ms 12ms 25.7MB 1057ms 13ms zig 0.11.0-dev.1577+11cc1c16f
swift 2-m.swift 2227ms 12ms 42.1MB 4180ms 30ms swift 5.7.3

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 121ms 1.3ms 7.5MB 110ms 0ms zig 0.11.0-dev.1577+11cc1c16f
swift 2-m.swift 393ms 32ms 33.6MB 630ms 17ms swift 5.7.3

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2.zig 262ms 4.7ms 1.1MB 253ms 0ms zig 0.11.0-dev.1577+11cc1c16f
zig 1.zig 388ms 4.0ms 1.0MB 380ms 0ms zig 0.11.0-dev.1577+11cc1c16f
swift 7.swift 453ms 6.5ms 5.2MB 443ms 0ms swift 5.7.3

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 2.zig 28ms 0.8ms 1.1MB 20ms 0ms zig 0.11.0-dev.1577+11cc1c16f
zig 1.zig 41ms 0.9ms 1.0MB 30ms 0ms zig 0.11.0-dev.1577+11cc1c16f
swift 7.swift 49ms 2.8ms 5.2MB 40ms 0ms swift 5.7.3

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 2010ms 3.2ms 2.3MB 1980ms 10ms zig 0.11.0-dev.1577+11cc1c16f
swift 1.swift timeout 0.0ms 6.7MB 4970ms 10ms swift 5.7.3

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
zig 1.zig 461ms 0.9ms 1.9MB 450ms 0ms zig 0.11.0-dev.1577+11cc1c16f
swift 1.swift 2616ms 0.1ms 6.3MB 2600ms 3ms swift 5.7.3