Swift VS Wasm benchmarks

Current benchmark data was generated on Mon Dec 30 2024, 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
wasm 5.rs 1721ms 55ms 34.9MB 1707ms 0ms wasmtime 28.0.0
wasm 3.rs 1751ms 19ms 52.9MB 1727ms 13ms wasmtime 28.0.0
wasm 4.rs 1758ms 1.3ms 34.9MB 1733ms 10ms wasmtime 28.0.0
swift 1.swift 2572ms 20ms 53.9MB 2543ms 13ms swift 6.0.3

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 3.rs 169ms 2.4ms 22.9MB 153ms 3ms wasmtime 28.0.0
wasm 5.rs 170ms 5.5ms 21.0MB 157ms 3ms wasmtime 28.0.0
wasm 4.rs 172ms 2.6ms 21.2MB 157ms 0ms wasmtime 28.0.0
swift 1.swift 236ms 3.1ms 11.9MB 220ms 0ms swift 6.0.3

fannkuch-redux

Input: 11

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 1.swift 2461ms 9.5ms 5.6MB 2450ms 0ms swift 6.0.3
wasm 1.rs 4181ms 12ms 20.6MB 4163ms 0ms wasmtime 28.0.0

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 1.swift 211ms 2.1ms 5.8MB 197ms 0ms swift 6.0.3
wasm 1.rs 355ms 3.4ms 18.7MB 347ms 0ms wasmtime 28.0.0

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 3-m.swift 138ms 0.6ms 24.8MB 380ms 10ms swift 6.0.3
wasm 1.rs 234ms 1.6ms 19.0MB 220ms 0ms wasmtime 28.0.0

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 1.rs 31ms 0.9ms 19.0MB 23ms 0ms wasmtime 28.0.0
swift 3.swift 36ms 0.1ms 18.1MB 33ms 0ms swift 6.0.3

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 1.swift 2.6ms 0.3ms 6.0MB 0ms 0ms swift 6.0.3
wasm 1.rs 6.6ms 0.3ms 19.5MB 0ms 0ms wasmtime 28.0.0

knucleotide

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 2-m.swift 1385ms 14ms 72.7MB 5030ms 27ms 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 260ms 2.1ms 64.0MB 680ms 30ms swift 6.0.3

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 7.swift 343ms 2.3ms 9.8MB 333ms 0ms swift 6.0.3
wasm 1.rs 399ms 1.0ms 20.8MB 387ms 0ms wasmtime 28.0.0
wasm 2.rs 576ms 0.3ms 18.8MB 563ms 0ms wasmtime 28.0.0

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 7.swift 39ms 0.2ms 9.8MB 27ms 0ms swift 6.0.3
wasm 1.rs 47ms 0.6ms 19.0MB 40ms 0ms wasmtime 28.0.0
wasm 2.rs 66ms 0.7ms 18.8MB 57ms 0ms wasmtime 28.0.0

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 2160ms 1.2ms 21.7MB 2143ms 0ms wasmtime 28.0.0
swift 1.swift timeout 0.0ms 7.2MB 4940ms 43ms swift 6.0.3

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
wasm 2.rs 511ms 0.5ms 21.2MB 500ms 0ms wasmtime 28.0.0
swift 1.swift 1902ms 81ms 6.9MB 1887ms 0ms swift 6.0.3