Swift VS Python benchmarks

Current benchmark data was generated on Fri May 20 2022, 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 3451ms 12ms 5.4MB 3427ms 3ms swift 5.6.1

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 1.swift 302ms 17ms 5.2MB 280ms 0ms swift 5.6.1

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 3-m.swift 369ms 4.6ms 21.0MB 663ms 7ms swift 5.6.1
python 1.py 2691ms 81ms 90.8MB 2643ms 30ms pypy 3.8.13
python 5-m.py 3357ms 14ms 12.9MB 4937ms 1013ms pyston 3.8.12
python 5-m.py 3998ms 20ms 85.2MB 4463ms 930ms pypy 3.8.13
python 1.py 4467ms 32ms 8.2MB 4447ms 3ms pyston 3.8.12
python 5-m.py 4473ms 26ms 12.1MB 6287ms 1063ms cpython 3.10.4
python 1.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.4

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 3.swift 64ms 15ms 14.6MB 60ms 0ms swift 5.6.1
python 1.py 347ms 5.0ms 81.5MB 320ms 13ms pypy 3.8.13
python 5-m.py 408ms 6.5ms 12.9MB 537ms 130ms pyston 3.8.12
python 1.py 460ms 2.0ms 8.2MB 447ms 0ms pyston 3.8.12
python 5-m.py 522ms 3.8ms 12.0MB 670ms 147ms cpython 3.10.4
python 1.py 732ms 8.2ms 7.8MB 717ms 0ms cpython 3.10.4
python 5-m.py 813ms 7.3ms 85.3MB 900ms 443ms pypy 3.8.13

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 1.swift 7.3ms 9.6ms 4.8MB 0ms 0ms swift 5.6.1
python 1.py 14ms 1.1ms 7.6MB 10ms 0ms pyston 3.8.12
python 1.py 15ms 0.6ms 7.5MB 10ms 0ms cpython 3.10.4
python 1.py 34ms 1.1ms 53.6MB 10ms 10ms pypy 3.8.13

knucleotide

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 2-m.swift 2306ms 390ms 54.4MB 3920ms 23ms swift 5.6.1
python 3-m.py 3674ms 52ms 204.5MB 6457ms 323ms pypy 3.8.13
python 3.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.4
python 3.py timeout 0.0ms 0.0MB 0ms 0ms 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 385ms 25ms 33.7MB 637ms 10ms swift 5.6.1
python 3-m.py 539ms 4.5ms 97.1MB 800ms 100ms pypy 3.8.13
python 3-m.py 656ms 4.0ms 16.3MB 1163ms 30ms pyston 3.8.12
python 3-m.py 932ms 8.3ms 15.3MB 1690ms 33ms cpython 3.10.4

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 7.swift 426ms 0.4ms 5.4MB 417ms 0ms swift 5.6.1
python 2.py 2186ms 36ms 79.8MB 2157ms 13ms pypy 3.8.13
python 1.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.4
python 2.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.4
python 1.py timeout 0.0ms 0.0MB 0ms 0ms pypy 3.8.13
python 1.py timeout 0.0ms 0.0MB 0ms 0ms pyston 3.8.12
python 2.py timeout 0.0ms 0.0MB 0ms 0ms pyston 3.8.12

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
swift 7.swift 55ms 14ms 5.4MB 40ms 0ms swift 5.6.1
python 2.py 282ms 2.1ms 79.5MB 257ms 10ms pypy 3.8.13
python 1.py 590ms 2.3ms 79.7MB 563ms 10ms pypy 3.8.13
python 1.py 1463ms 3.4ms 8.6MB 1450ms 0ms pyston 3.8.12
python 2.py 2152ms 28ms 8.5MB 2140ms 0ms pyston 3.8.12
python 1.py 4709ms 32ms 7.3MB 4693ms 0ms cpython 3.10.4
python 2.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.4

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 4.py 2762ms 3.2ms 9.4MB 2727ms 17ms pyston 3.8.12
python 4.py 2782ms 2.3ms 8.5MB 2740ms 23ms cpython 3.10.4
python 4.py 2800ms 13ms 119.5MB 2757ms 27ms pypy 3.8.13
swift 1.swift timeout 0.0ms 0.0MB 0ms 0ms swift 5.6.1

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 4.py 655ms 0.7ms 9.1MB 643ms 0ms pyston 3.8.12
python 4.py 666ms 2.4ms 8.3MB 650ms 0ms cpython 3.10.4
python 4.py 694ms 12ms 84.5MB 663ms 13ms pypy 3.8.13
swift 1.swift 3474ms 78ms 6.4MB 3450ms 0ms swift 5.6.1