Swift VS C# benchmarks

Current benchmark data was generated on Fri May 20 2022, 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 3451ms 12ms 5.4MB 3427ms 3ms swift 5.6.1

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 1.swift 302ms 17ms 5.2MB 280ms 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 369ms 4.6ms 21.0MB 663ms 7ms swift 5.6.1
csharp 5-m.cs 386ms 15ms 89.8MB 553ms 117ms dotnet 6.0.300
csharp 5-m.cs 493ms 9.8ms 59.0MB 813ms 110ms mono 6.12.0

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 3.swift 64ms 15ms 14.6MB 60ms 0ms swift 5.6.1
csharp 5.cs 90ms 15ms 36.1MB 100ms 33ms mono 6.12.0
csharp 5.cs 99ms 9.1ms 45.3MB 90ms 23ms dotnet 6.0.300

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 1.swift 7.3ms 9.6ms 4.8MB 0ms 0ms swift 5.6.1
csharp 1.cs 19ms 0.4ms 24.3MB 10ms 0ms mono 6.12.0
csharp 1.cs 50ms 4.7ms 32.9MB 24ms 2ms dotnet 6.0.300

knucleotide

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 6.cs 1349ms 172ms 78.1MB 1697ms 40ms dotnet 6.0.300
csharp 6-m.cs 1608ms 60ms 71.9MB 2610ms 23ms mono 6.12.0
swift 2-m.swift 2306ms 390ms 54.4MB 3920ms 23ms swift 5.6.1

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 6.cs 237ms 6.1ms 66.0MB 250ms 23ms dotnet 6.0.300
csharp 6.cs 251ms 7.8ms 52.7MB 333ms 10ms mono 6.12.0
swift 2-m.swift 385ms 25ms 33.7MB 637ms 10ms swift 5.6.1

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 7.swift 426ms 0.4ms 5.4MB 417ms 0ms swift 5.6.1
csharp 9.cs 438ms 9.0ms 29.3MB 410ms 0ms dotnet 6.0.300
csharp 8.cs 537ms 3.7ms 29.1MB 503ms 3ms dotnet 6.0.300
csharp 8.cs 1110ms 1.7ms 27.0MB 1097ms 0ms mono 6.12.0

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 7.swift 55ms 14ms 5.4MB 40ms 0ms swift 5.6.1
csharp 9.cs 95ms 4.6ms 29.2MB 67ms 0ms dotnet 6.0.300
csharp 8.cs 101ms 4.9ms 31.2MB 77ms 0ms dotnet 6.0.300
csharp 8.cs 135ms 4.1ms 27.0MB 123ms 0ms mono 6.12.0

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 1.cs timeout 0.0ms 0.0MB 0ms 0ms dotnet 6.0.300
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
csharp 1.cs 1281ms 9.1ms 90.8MB 1277ms 30ms dotnet 6.0.300
swift 1.swift 3474ms 78ms 6.4MB 3450ms 0ms swift 5.6.1