Swift VS C benchmarks

Current benchmark data was generated on Wed May 25 2022, 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
swift 1.swift 2827ms 209ms 5.2MB 2813ms 0ms swift 5.6.1

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 1.swift 259ms 3.3ms 5.2MB 247ms 0ms swift 5.6.1

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 3-m.swift 300ms 5.8ms 21.0MB 530ms 10ms swift 5.6.1

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 3.swift 47ms 1.6ms 14.7MB 43ms 0ms swift 5.6.1

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 1.c 1.8ms 0.7ms 0.9MB 0ms 0ms gcc 12.1.0
c 1.c 2.2ms 0.7ms 1.1MB 0ms 0ms clang 11.0.0
c 1.c 2.9ms 1.6ms 0.6MB 0ms 0ms zigcc 0.10.0
swift 1.swift 3.0ms 1.8ms 2.4MB 0ms 0ms swift 5.6.1

knucleotide

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 1-m.c 239ms 9.2ms 23.5MB 397ms 7ms gcc 12.1.0
c 1-m.c 534ms 27ms 20.4MB 853ms 13ms clang 11.0.0
swift 2-m.swift 1976ms 37ms 42.7MB 3600ms 23ms swift 5.6.1

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 1.c 34ms 0.3ms 12.8MB 40ms 3ms gcc 12.1.0
c 1-m.c 64ms 1.5ms 9.6MB 100ms 0ms clang 11.0.0
swift 2-m.swift 357ms 25ms 31.9MB 557ms 23ms swift 5.6.1

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 8-i.c 318ms 4.5ms 1.1MB 300ms 0ms clang 11.0.0
c 8-i.c 320ms 17ms 1.0MB 310ms 0ms gcc 12.1.0
c 5.c 334ms 0.4ms 1.0MB 320ms 0ms gcc 12.1.0
c 8-i.c 339ms 0.3ms 0.6MB 330ms 0ms zigcc 0.10.0
c 5.c 361ms 4.0ms 1.1MB 350ms 0ms clang 11.0.0
c 5.c 426ms 0.4ms 0.6MB 413ms 0ms zigcc 0.10.0
swift 7.swift 428ms 28ms 5.4MB 420ms 0ms swift 5.6.1
c 2.c 431ms 3.8ms 0.6MB 420ms 0ms zigcc 0.10.0
c 2.c 458ms 12ms 1.1MB 437ms 0ms clang 11.0.0
c 2.c 478ms 5.8ms 1.0MB 467ms 0ms gcc 12.1.0

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 8-i.c 36ms 0.4ms 0.6MB 30ms 0ms zigcc 0.10.0
c 8-i.c 36ms 0.3ms 0.9MB 23ms 0ms gcc 12.1.0
c 8-i.c 37ms 2.3ms 1.1MB 23ms 0ms clang 11.0.0
c 5.c 37ms 2.9ms 1.1MB 30ms 0ms clang 11.0.0
c 5.c 37ms 2.0ms 1.0MB 23ms 0ms gcc 12.1.0
swift 7.swift 43ms 0.7ms 5.4MB 33ms 0ms swift 5.6.1
c 5.c 45ms 0.2ms 0.6MB 37ms 0ms zigcc 0.10.0
c 2.c 45ms 0.1ms 0.6MB 33ms 0ms zigcc 0.10.0
c 2.c 47ms 3.4ms 1.1MB 37ms 0ms clang 11.0.0
c 2.c 50ms 0.4ms 1.0MB 40ms 0ms gcc 12.1.0

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 1.swift timeout 0.0ms 0.0MB 0ms 0ms swift 5.6.1

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 1.swift 3278ms 2.4ms 6.4MB 3260ms 0ms swift 5.6.1