Swift VS Python 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
swift 3.swift 474ms 12ms 21.1MB 630ms 10ms swift 5.7.3
python 5-m.py 3319ms 2874ms 76.1MB 6847ms 1390ms pypy 3.9.16
python 1.py 3477ms 32ms 84.7MB 3433ms 23ms pypy 3.9.16
python 5-m.py 3960ms 31ms 12.5MB 5733ms 1390ms pyston 3.8.12
python 1.py 4684ms 24ms 7.9MB 4667ms 0ms pyston 3.8.12
python 5-m.py 4713ms 13ms 13.6MB 6807ms 1347ms cpython 3.11.2
python 1.py timeout 0.0ms 8.6MB 4977ms 3ms cpython 3.11.2

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 3.swift 74ms 2.7ms 14.7MB 60ms 0ms swift 5.7.3
python 1.py 425ms 2.0ms 73.7MB 383ms 23ms pypy 3.9.16
python 5-m.py 479ms 2.6ms 12.6MB 630ms 173ms pyston 3.8.12
python 1.py 495ms 15ms 7.9MB 480ms 0ms pyston 3.8.12
python 5-m.py 559ms 1.6ms 13.5MB 737ms 167ms cpython 3.11.2
python 1.py 715ms 1.6ms 8.7MB 700ms 0ms cpython 3.11.2
python 5-m.py 932ms 8.4ms 76.0MB 1000ms 530ms pypy 3.9.16

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
python 1.py 15ms 0.7ms 7.3MB 10ms 0ms pyston 3.8.12
python 1.py 16ms 1.3ms 8.5MB 10ms 0ms cpython 3.11.2
python 1.py 39ms 0.9ms 52.8MB 12ms 12ms pypy 3.9.16

knucleotide

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 2-m.swift 2402ms 35ms 44.4MB 4443ms 47ms swift 5.7.3
python 3-m.py 4923ms 24ms 209.9MB 8630ms 467ms pypy 3.9.16
python 3.py timeout 0.0ms 35.1MB 100ms 27ms cpython 3.11.2
python 3.py timeout 0.0ms 34.2MB 80ms 27ms pyston 3.8.12

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 2-m.swift 496ms 97ms 41.4MB 723ms 27ms swift 5.7.3
python 3-m.py 686ms 12ms 86.1MB 1000ms 143ms pypy 3.9.16
python 3-m.py 737ms 14ms 17.6MB 1283ms 47ms pyston 3.8.12
python 3-m.py 1024ms 9.7ms 16.9MB 1843ms 43ms cpython 3.11.2

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 7.swift 565ms 41ms 5.1MB 553ms 0ms swift 5.7.3
python 2.py 2414ms 33ms 71.4MB 2383ms 17ms pypy 3.9.16
python 1.py 4354ms 39ms 70.3MB 4317ms 17ms pypy 3.9.16
python 1.py timeout 0.0ms 8.4MB 4983ms 0ms cpython 3.11.2
python 2.py timeout 0.0ms 8.6MB 4987ms 0ms cpython 3.11.2
python 1.py timeout 0.0ms 8.4MB 4983ms 3ms pyston 3.8.12
python 2.py timeout 0.0ms 7.9MB 4973ms 7ms pyston 3.8.12

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
python 2.py 309ms 3.3ms 71.0MB 277ms 17ms pypy 3.9.16
python 1.py 499ms 4.8ms 70.3MB 460ms 20ms pypy 3.9.16
python 1.py 1397ms 19ms 8.3MB 1380ms 0ms pyston 3.8.12
python 2.py 1891ms 7.9ms 7.9MB 1873ms 3ms pyston 3.8.12
python 1.py 3917ms 146ms 8.4MB 3903ms 0ms cpython 3.11.2
python 2.py 4128ms 39ms 8.6MB 4107ms 0ms cpython 3.11.2

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 4.py 2886ms 4.0ms 9.0MB 2840ms 27ms pyston 3.8.12
python 4.py 2892ms 0.9ms 9.5MB 2843ms 33ms cpython 3.11.2
python 4.py 2991ms 35ms 125.0MB 2913ms 57ms pypy 3.9.16
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
python 4.py 705ms 18ms 9.1MB 687ms 0ms cpython 3.11.2
python 4.py 713ms 23ms 8.8MB 700ms 0ms pyston 3.8.12
python 4.py 774ms 10ms 77.2MB 730ms 23ms pypy 3.9.16
swift 1.swift 3180ms 62ms 6.2MB 3163ms 0ms swift 5.7.3