Swift VS D 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
swift 1.swift 3393ms 14ms 2.4MB 3377ms 0ms swift 5.7.3
d 1.d 4276ms 15ms 1.5MB 4260ms 0ms ldc2 1.30.0
d 1-im.d 4815ms 15ms 1.5MB 9373ms 0ms ldc2 1.30.0
d 1-i.d timeout 0.0ms 1.9MB 4990ms 0ms dmd 2.101.2
d 1-im.d timeout 0.0ms 4.1MB 9823ms 0ms dmd 2.101.2
d 1.d timeout 0.0ms 2.4MB 4990ms 0ms dmd 2.101.2
d 2-i.d timeout 0.0ms 2.3MB 4987ms 0ms dmd 2.101.2
d 2-im.d timeout 0.0ms 4.1MB 9853ms 7ms dmd 2.101.2
d 1-i.d timeout 0.0ms 1.5MB 4987ms 0ms ldc2 1.30.0
d 2-i.d timeout 0.0ms 1.6MB 4987ms 0ms ldc2 1.30.0
d 2-im.d timeout 0.0ms 1.6MB 9873ms 0ms ldc2 1.30.0

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 1.swift 285ms 0.5ms 5.3MB 273ms 0ms swift 5.7.3
d 1.d 360ms 5.9ms 1.6MB 347ms 0ms ldc2 1.30.0
d 1-im.d 402ms 5.3ms 1.5MB 767ms 0ms ldc2 1.30.0
d 1.d 439ms 0.9ms 2.4MB 430ms 0ms dmd 2.101.2
d 1-im.d 489ms 3.3ms 4.0MB 923ms 0ms dmd 2.101.2
d 1-i.d 763ms 5.4ms 1.5MB 753ms 0ms ldc2 1.30.0
d 2-im.d 773ms 1.1ms 1.5MB 1470ms 3ms ldc2 1.30.0
d 2-im.d 856ms 50ms 2.3MB 1607ms 0ms dmd 2.101.2
d 1-i.d 857ms 0.7ms 1.9MB 847ms 0ms dmd 2.101.2
d 2-i.d 1451ms 0.8ms 1.5MB 1440ms 0ms ldc2 1.30.0
d 2-i.d 1507ms 0.9ms 2.3MB 1497ms 0ms dmd 2.101.2

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 235ms 7.0ms 28.5MB 217ms 7ms ldc2 1.30.0
swift 3-m.swift 390ms 3.2ms 20.9MB 687ms 10ms swift 5.7.3
d 1.d 793ms 2.2ms 40.3MB 773ms 7ms dmd 2.101.2

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 28ms 1.8ms 7.4MB 17ms 0ms ldc2 1.30.0
swift 3.swift 58ms 0.9ms 14.6MB 53ms 3ms swift 5.7.3
d 1.d 82ms 0.7ms 9.2MB 70ms 0ms dmd 2.101.2

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
d 1.d 2.1ms 0.6ms 3.0MB 0ms 0ms ldc2 1.30.0
d 1.d 2.3ms 0.6ms 4.0MB 0ms 0ms dmd 2.101.2

knucleotide

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1-m.d 1060ms 13ms 60.6MB 1837ms 17ms ldc2 1.30.0
swift 2-m.swift 2299ms 268ms 42.5MB 4253ms 23ms swift 5.7.3
d 1-m.d 4045ms 73ms 55.9MB 7203ms 20ms dmd 2.101.2

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1-m.d 134ms 5.8ms 39.2MB 220ms 3ms ldc2 1.30.0
swift 2-m.swift 381ms 27ms 33.6MB 643ms 13ms swift 5.7.3
d 1-m.d 419ms 16ms 42.4MB 757ms 3ms dmd 2.101.2

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 409ms 1.3ms 1.5MB 400ms 0ms ldc2 1.30.0
d 2.d 422ms 0.1ms 1.5MB 410ms 0ms ldc2 1.30.0
swift 7.swift 426ms 0.2ms 5.1MB 410ms 0ms swift 5.7.3
d 1.d 1535ms 4.6ms 2.3MB 1523ms 0ms dmd 2.101.2
d 2.d 2861ms 4.3ms 2.3MB 2850ms 0ms dmd 2.101.2

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 43ms 0.4ms 1.6MB 33ms 0ms ldc2 1.30.0
d 2.d 45ms 0.1ms 1.5MB 37ms 0ms ldc2 1.30.0
swift 7.swift 45ms 0.5ms 5.1MB 37ms 0ms swift 5.7.3
d 1.d 156ms 0.5ms 2.3MB 150ms 0ms dmd 2.101.2
d 2.d 290ms 0.5ms 2.4MB 280ms 0ms dmd 2.101.2

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 3481ms 14ms 7.8MB 3460ms 13ms ldc2 1.30.0
d 1.d timeout 0.0ms 8.8MB 4980ms 17ms dmd 2.101.2
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
d 1.d 826ms 2.3ms 7.7MB 813ms 3ms ldc2 1.30.0
d 1.d 1659ms 2.9ms 8.9MB 1647ms 0ms dmd 2.101.2
swift 1.swift 2571ms 3.4ms 6.2MB 2553ms 3ms swift 5.7.3