Swift VS Lua benchmarks

Current benchmark data was generated on Sat Mar 29 2025, full log can be found HERE

CONTRIBUTIONS are WELCOME!

[x86_64][4 cores] AMD EPYC 7763 64-Core Processor (Model 1)

* -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.)

binarytrees

Input: 18

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 1.swift 2915ms 17ms 53.9MB 2883ms 17ms swift 6.0.3
lua 1.lua 3568ms 85ms 172.9MB 3437ms 117ms luajit 2.1.0-beta3
lua 1.lua timeout 0.0ms 104.9MB 4950ms 37ms lua 5.4.7

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 1.swift 239ms 4.6ms 11.8MB 227ms 0ms swift 6.0.3
lua 1.lua 296ms 3.5ms 15.9MB 277ms 10ms luajit 2.1.0-beta3
lua 1.lua 821ms 7.9ms 16.9MB 807ms 0ms lua 5.4.7

fannkuch-redux

Input: 11

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 1.swift 2489ms 22ms 5.8MB 2477ms 0ms swift 6.0.3

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 1.swift 213ms 2.3ms 5.8MB 200ms 0ms swift 6.0.3

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 3-m.swift 135ms 0.8ms 20.7MB 387ms 3ms swift 6.0.3

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 3.swift 37ms 0.1ms 18.2MB 30ms 0ms swift 6.0.3

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
lua 1.lua 1.4ms 0.1ms 2.4MB 0ms 0ms luajit 2.1.0-beta3
lua 1.lua 1.9ms 0.4ms 2.1MB 0ms 0ms lua 5.4.7
swift 1.swift 2.6ms 0.2ms 5.9MB 0ms 0ms swift 6.0.3

knucleotide

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 2-m.swift 1417ms 29ms 74.7MB 5187ms 33ms swift 6.0.3

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 2-m.swift 268ms 2.0ms 59.8MB 697ms 33ms swift 6.0.3

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 7.swift 346ms 0.4ms 9.8MB 340ms 0ms swift 6.0.3
lua 4.lua 716ms 2.9ms 2.3MB 707ms 0ms luajit 2.1.0-beta3
lua 4.lua timeout 0.0ms 2.3MB 4990ms 0ms lua 5.4.7

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 7.swift 39ms 1.0ms 10.0MB 30ms 0ms swift 6.0.3
lua 4.lua 76ms 2.2ms 2.3MB 70ms 0ms luajit 2.1.0-beta3
lua 4.lua 1106ms 23ms 2.3MB 1097ms 0ms lua 5.4.7

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 1.swift timeout 0.0ms 7.1MB 4933ms 53ms swift 6.0.3

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 1.swift 1876ms 12ms 6.9MB 1863ms 0ms swift 6.0.3