Swift VS Ruby benchmarks

Current benchmark data was generated on Sun Jan 29 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 3382ms 1.8ms 2.5MB 3370ms 0ms swift 5.7.3

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 1.swift 284ms 0.9ms 2.4MB 270ms 0ms swift 5.7.3

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 3-m.swift 380ms 10ms 20.9MB 690ms 3ms swift 5.7.3
ruby 6.rb 2344ms 2.0ms 43.6MB 2310ms 17ms ruby/yjit 3.2.0
ruby 6-m.rb 2496ms 56ms 375.1MB 4513ms 257ms truffleruby 22.3.1
ruby 6.rb 4310ms 33ms 43.1MB 4283ms 17ms ruby 3.2.0

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 3.swift 56ms 0.5ms 14.6MB 60ms 0ms swift 5.7.3
ruby 6.rb 305ms 1.2ms 34.8MB 280ms 10ms ruby/yjit 3.2.0
ruby 6.rb 497ms 2.8ms 34.4MB 477ms 3ms ruby 3.2.0
ruby 6-m.rb 801ms 16ms 318.7MB 1377ms 97ms truffleruby 22.3.1

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 1.swift 2.2ms 1.1ms 2.3MB 0ms 0ms swift 5.7.3
ruby 1.rb 41ms 2.6ms 156.3MB 16ms 26ms truffleruby 22.3.1
ruby 1.rb 72ms 0.3ms 32.5MB 46ms 14ms ruby/yjit 3.2.0
ruby 1.rb 72ms 0.5ms 32.1MB 48ms 12ms ruby 3.2.0

knucleotide

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 2-m.swift 2299ms 439ms 52.3MB 3857ms 27ms swift 5.7.3

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 2-m.swift 353ms 6.9ms 31.4MB 600ms 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 431ms 9.3ms 5.1MB 417ms 0ms swift 5.7.3
ruby 2.rb 1013ms 1.8ms 306.6MB 1220ms 67ms truffleruby 22.3.1
ruby 2.rb timeout 0.0ms 32.2MB 4973ms 10ms ruby 3.2.0
ruby 2.rb timeout 0.0ms 33.0MB 4967ms 17ms ruby/yjit 3.2.0

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 7.swift 48ms 2.9ms 5.1MB 40ms 0ms swift 5.7.3
ruby 2-m.rb 380ms 2.8ms 305.0MB 580ms 73ms truffleruby 22.3.1
ruby 2.rb 2169ms 0.8ms 33.0MB 2140ms 10ms ruby/yjit 3.2.0
ruby 2.rb 3369ms 22ms 32.2MB 3340ms 13ms ruby 3.2.0

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 1.rb timeout 0.0ms 158.2MB 4917ms 57ms ruby 3.2.0
ruby 1.rb timeout 0.0ms 158.6MB 4930ms 50ms ruby/yjit 3.2.0
ruby 1.rb timeout 0.0ms 428.4MB 9447ms 213ms truffleruby 22.3.1
swift 1.swift timeout 0.0ms 6.7MB 4957ms 23ms swift 5.7.3

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 1-m.rb 1921ms 17ms 423.5MB 3527ms 133ms truffleruby 22.3.1
ruby 1.rb 2377ms 5.5ms 159.8MB 2310ms 47ms ruby/yjit 3.2.0
ruby 1.rb 2381ms 3.7ms 158.3MB 2307ms 60ms ruby 3.2.0
swift 1.swift 2577ms 13ms 6.5MB 2557ms 0ms swift 5.7.3