Swift VS C# benchmarks

Current benchmark data was generated on Wed Feb 08 2023, full log can be found HERE

CONTRIBUTIONS are WELCOME!

[x86_64][2 cores] Intel(R) Xeon(R) Platinum 8171M 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 3536ms 37ms 2.4MB 3527ms 0ms swift 5.7.3

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 1.swift 293ms 2.8ms 5.2MB 283ms 0ms swift 5.7.3

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 5-m.cs 372ms 28ms 67.2MB 583ms 107ms dotnet/aot 7.0.102
swift 3.swift 474ms 12ms 21.1MB 630ms 10ms swift 5.7.3
csharp 5-m.cs 590ms 61ms 156.5MB 887ms 137ms dotnet 7.0.102
csharp 5-m.cs 645ms 15ms 60.3MB 1077ms 137ms mono 6.12.0

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 5.cs 73ms 29ms 24.4MB 77ms 27ms dotnet/aot 7.0.102
swift 3.swift 74ms 2.7ms 14.7MB 60ms 0ms swift 5.7.3
csharp 5.cs 107ms 3.8ms 34.1MB 137ms 23ms mono 6.12.0
csharp 5.cs 163ms 6.8ms 111.5MB 130ms 70ms dotnet 7.0.102

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 1.swift 4.4ms 0.2ms 0.0MB 0ms 0ms swift 5.7.3
csharp 1.cs 8.0ms 0.9ms 10.1MB 0ms 0ms dotnet/aot 7.0.102
csharp 1.cs 24ms 1.3ms 23.6MB 10ms 2ms mono 6.12.0
csharp 1.cs 91ms 4.1ms 101.5MB 30ms 32ms dotnet 7.0.102

knucleotide

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 6.cs 1218ms 5.5ms 53.5MB 1800ms 23ms dotnet/aot 7.0.102
csharp 6-m.cs 1586ms 11ms 144.3MB 2663ms 63ms dotnet 7.0.102
csharp 6-m.cs 2173ms 107ms 71.3MB 3497ms 33ms mono 6.12.0
swift 2-m.swift 2402ms 35ms 44.4MB 4443ms 47ms swift 5.7.3

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 6.cs 188ms 6.5ms 42.3MB 210ms 30ms dotnet/aot 7.0.102
csharp 6.cs 326ms 31ms 53.5MB 440ms 17ms mono 6.12.0
csharp 6.cs 355ms 8.1ms 132.9MB 387ms 67ms dotnet 7.0.102
swift 2-m.swift 496ms 97ms 41.4MB 723ms 27ms swift 5.7.3

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 9.cs 531ms 2.8ms 98.0MB 463ms 33ms dotnet 7.0.102
swift 7.swift 565ms 41ms 5.1MB 553ms 0ms swift 5.7.3
csharp 8.cs 686ms 14ms 12.3MB 680ms 0ms dotnet/aot 7.0.102
csharp 8.cs 742ms 6.0ms 99.9MB 673ms 37ms dotnet 7.0.102
csharp 8.cs 1535ms 1.6ms 25.0MB 1513ms 3ms mono 6.12.0

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 7.swift 58ms 2.1ms 5.1MB 47ms 0ms swift 5.7.3
csharp 8.cs 78ms 3.2ms 10.0MB 73ms 0ms dotnet/aot 7.0.102
csharp 9.cs 144ms 2.8ms 98.4MB 83ms 33ms dotnet 7.0.102
csharp 8.cs 172ms 6.9ms 102.3MB 117ms 27ms dotnet 7.0.102
csharp 8.cs 181ms 0.8ms 25.0MB 157ms 3ms 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 155.9MB 4923ms 147ms dotnet 7.0.102
csharp 1.cs timeout 0.0ms 57.3MB 4960ms 33ms dotnet/aot 7.0.102
swift 1.swift timeout 0.0ms 6.3MB 4967ms 10ms swift 5.7.3

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 1.cs 1333ms 7.2ms 56.5MB 1290ms 33ms dotnet/aot 7.0.102
csharp 1.cs 1458ms 0.2ms 156.3MB 1413ms 90ms dotnet 7.0.102
swift 1.swift 3180ms 62ms 6.2MB 3163ms 0ms swift 5.7.3