Swift VS Go 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
go 3-m.go 1413ms 29ms 5.0MB 2707ms 0ms go 1.19.5
go 3.go 2936ms 4.8ms 49.9MB 2917ms 3ms tinygo 0.25.0
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
go 3-m.go 142ms 2.3ms 5.0MB 220ms 0ms go 1.19.5
swift 1.swift 285ms 0.5ms 5.3MB 273ms 0ms swift 5.7.3
go 3.go 314ms 5.9ms 47.6MB 297ms 3ms tinygo 0.25.0

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 3-m.go 251ms 1.7ms 2.9MB 453ms 0ms go 1.19.5
swift 3-m.swift 390ms 3.2ms 20.9MB 687ms 10ms swift 5.7.3

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 3.go 32ms 0.1ms 2.9MB 40ms 0ms go 1.19.5
swift 3.swift 58ms 0.9ms 14.6MB 53ms 3ms swift 5.7.3

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 1.swift 1.8ms 0.1ms 2.3MB 0ms 0ms swift 5.7.3
go 1.go 2.0ms 1.3ms 0.0MB 0ms 0ms tinygo 0.25.0
go 1.go 2.6ms 0.5ms 2.9MB 0ms 0ms go 1.19.5

knucleotide

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 7-m.go 1512ms 45ms 38.5MB 2780ms 27ms go 1.19.5
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
go 7-m.go 244ms 12ms 23.5MB 383ms 17ms go 1.19.5
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
swift 7.swift 426ms 0.2ms 5.1MB 410ms 0ms swift 5.7.3
go 1.go 458ms 2.3ms 2.9MB 443ms 0ms go 1.19.5
go 1.go 843ms 1.9ms 0.0MB 830ms 0ms tinygo 0.25.0

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 7.swift 45ms 0.5ms 5.1MB 37ms 0ms swift 5.7.3
go 1.go 50ms 2.0ms 2.9MB 40ms 0ms go 1.19.5
go 1.go 87ms 1.1ms 0.0MB 80ms 0ms tinygo 0.25.0

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 8.go 1388ms 1.8ms 10.4MB 1367ms 0ms go 1.19.5
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
go 8.go 334ms 1.0ms 10.3MB 310ms 3ms go 1.19.5
swift 1.swift 2571ms 3.4ms 6.2MB 2553ms 3ms swift 5.7.3