D VS Python benchmarks

Current benchmark data was generated on Thu Sep 22 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.)

binarytrees

Input: 18

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 1574ms 2.7ms 274.1MB 1453ms 100ms pypy 3.8.13
d 1.d 3009ms 27ms 75.1MB 3247ms 0ms ldc2 1.30.0
d 1.d 4697ms 26ms 124.4MB 4803ms 20ms dmd 2.100.2
python 1.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.7
python 1.py timeout 0.0ms 0.0MB 0ms 0ms pyston 3.8.12

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 120ms 2.4ms 83.3MB 93ms 10ms pypy 3.8.13
d 1.d 260ms 0.9ms 15.1MB 247ms 0ms ldc2 1.30.0
d 1.d 390ms 4.8ms 16.3MB 380ms 0ms dmd 2.100.2
python 1.py 610ms 3.8ms 11.9MB 583ms 10ms pyston 3.8.12
python 1.py 1514ms 8.6ms 11.8MB 1493ms 3ms cpython 3.10.7

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 1164ms 15ms 196.7MB 1090ms 53ms pypy 3.8.13
d 1.d timeout 0.0ms 0.0MB 0ms 0ms dmd 2.100.2
d 1.d timeout 0.0ms 0.0MB 0ms 0ms ldc2 1.30.0
python 1.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.7
python 1.py timeout 0.0ms 0.0MB 0ms 0ms pyston 3.8.12

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 276ms 1.4ms 95.1MB 237ms 17ms pypy 3.8.13
python 1.py 966ms 3.5ms 16.8MB 947ms 3ms pyston 3.8.12
python 1.py 978ms 1.6ms 16.9MB 960ms 0ms cpython 3.10.7
d 1.d 1328ms 4.7ms 10.2MB 1313ms 0ms ldc2 1.30.0
d 1.d 1640ms 9.4ms 9.4MB 1620ms 7ms dmd 2.100.2

edigits

Input: 250001

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 828ms 1.6ms 87.8MB 797ms 20ms pypy 3.8.13
python 1.py 1670ms 1.4ms 9.3MB 1657ms 0ms cpython 3.10.7
python 1.py 2829ms 1.6ms 9.6MB 2820ms 0ms pyston 3.8.12
d 1.d 3825ms 4.1ms 8.0MB 3810ms 0ms ldc2 1.30.0
d 1.d 4476ms 0.9ms 8.9MB 4463ms 0ms dmd 2.100.2

Input: 100000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 213ms 0.8ms 81.9MB 190ms 10ms pypy 3.8.13
python 1.py 307ms 0.2ms 8.5MB 293ms 0ms cpython 3.10.7
python 1.py 488ms 0.9ms 8.8MB 470ms 0ms pyston 3.8.12
d 1.d 656ms 1.6ms 7.1MB 643ms 0ms ldc2 1.30.0
d 1.d 811ms 0.8ms 8.5MB 797ms 0ms dmd 2.100.2

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 202ms 0.8ms 28.2MB 183ms 3ms ldc2 1.30.0
d 1.d 770ms 1.1ms 47.8MB 753ms 7ms dmd 2.100.2
python 1.py 2607ms 3.7ms 91.1MB 2573ms 13ms pypy 3.8.13
python 5-m.py 3750ms 328ms 12.6MB 5597ms 1000ms pyston 3.8.12
python 5-m.py 3964ms 11ms 85.4MB 4430ms 853ms pypy 3.8.13
python 1.py 4082ms 19ms 7.8MB 4070ms 0ms pyston 3.8.12
python 5-m.py 4416ms 24ms 12.1MB 6350ms 1030ms cpython 3.10.7
python 1.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.7

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 24ms 1.2ms 7.9MB 17ms 0ms ldc2 1.30.0
d 1.d 81ms 1.0ms 9.9MB 70ms 0ms dmd 2.100.2
python 1.py 346ms 2.7ms 81.7MB 307ms 20ms pypy 3.8.13
python 1.py 424ms 5.3ms 7.9MB 410ms 0ms pyston 3.8.12
python 5-m.py 449ms 34ms 12.6MB 640ms 120ms pyston 3.8.12
python 5-m.py 513ms 1.8ms 12.1MB 660ms 147ms cpython 3.10.7
python 1.py 708ms 1.5ms 7.8MB 700ms 0ms cpython 3.10.7
python 5-m.py 821ms 4.5ms 85.2MB 950ms 420ms pypy 3.8.13

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 2.4ms 0.6ms 2.9MB 0ms 0ms ldc2 1.30.0
d 1.d 2.7ms 0.7ms 4.0MB 0ms 0ms dmd 2.100.2
python 1.py 13ms 0.7ms 7.3MB 10ms 0ms pyston 3.8.12
python 1.py 15ms 0.3ms 7.3MB 10ms 0ms cpython 3.10.7
python 1.py 34ms 2.4ms 54.0MB 14ms 6ms pypy 3.8.13

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 179ms 1.5ms 4.0MB 170ms 0ms ldc2 1.30.0
python 2.py 199ms 0.9ms 80.3MB 170ms 17ms pypy 3.8.13
python 1.py 241ms 0.6ms 81.0MB 213ms 13ms pypy 3.8.13
d 1.d 248ms 3.0ms 5.0MB 237ms 0ms dmd 2.100.2
python 1.py 993ms 2.8ms 8.9MB 977ms 0ms pyston 3.8.12
python 2.py 1176ms 4.2ms 8.7MB 1163ms 0ms pyston 3.8.12
python 1.py 1831ms 10ms 8.5MB 1817ms 0ms cpython 3.10.7
python 2.py 2615ms 35ms 8.3MB 2597ms 0ms cpython 3.10.7

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 2.py 468ms 4.4ms 80.4MB 443ms 7ms pypy 3.8.13
python 1.py 509ms 2.2ms 81.5MB 477ms 13ms pypy 3.8.13
d 1.d 526ms 2.0ms 4.1MB 513ms 0ms ldc2 1.30.0
d 1.d 727ms 3.8ms 5.0MB 713ms 0ms dmd 2.100.2
python 1.py 3011ms 54ms 9.0MB 3000ms 0ms pyston 3.8.12
python 2.py 3482ms 6.9ms 8.7MB 3470ms 0ms pyston 3.8.12
python 1.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.7
python 2.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.7

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 77ms 1.0ms 3.8MB 70ms 0ms ldc2 1.30.0
d 1.d 108ms 0.9ms 4.6MB 100ms 0ms dmd 2.100.2
python 2.py 145ms 1.3ms 80.1MB 117ms 13ms pypy 3.8.13
python 1.py 164ms 3.1ms 81.1MB 140ms 10ms pypy 3.8.13
python 1.py 481ms 2.8ms 8.7MB 467ms 0ms pyston 3.8.12
python 2.py 546ms 3.1ms 8.1MB 530ms 0ms pyston 3.8.12
python 1.py 862ms 4.4ms 7.8MB 853ms 0ms cpython 3.10.7
python 2.py 1257ms 5.4ms 7.3MB 1240ms 0ms cpython 3.10.7

mandelbrot

Input: 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 574ms 0.6ms 6.8MB 560ms 0ms ldc2 1.30.0
d 1.d 2510ms 1.5ms 7.6MB 2497ms 0ms dmd 2.100.2

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 27ms 0.2ms 2.9MB 20ms 0ms ldc2 1.30.0
d 1.d 107ms 0.6ms 3.5MB 93ms 0ms dmd 2.100.2

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 1407ms 16ms 74.9MB 1460ms 13ms ldc2 1.30.0
python 1.py 2434ms 16ms 293.6MB 2253ms 163ms pypy 3.8.13
d 1.d 2635ms 10ms 153.3MB 2933ms 27ms dmd 2.100.2
python 1.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.7
python 1.py timeout 0.0ms 0.0MB 0ms 0ms pyston 3.8.12

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 280ms 9.3ms 38.9MB 267ms 7ms ldc2 1.30.0
python 1.py 351ms 5.0ms 145.1MB 290ms 40ms pypy 3.8.13
d 1.d 542ms 2.3ms 39.8MB 587ms 0ms dmd 2.100.2
python 1.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.7
python 1.py timeout 0.0ms 0.0MB 0ms 0ms pyston 3.8.12

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 424ms 0.4ms 1.2MB 410ms 0ms ldc2 1.30.0
d 2.d 435ms 0.2ms 1.2MB 423ms 0ms ldc2 1.30.0
d 1.d 1533ms 0.2ms 1.9MB 1520ms 0ms dmd 2.100.2
python 2.py 2065ms 46ms 80.0MB 2033ms 13ms pypy 3.8.13
d 2.d 2677ms 1.5ms 2.0MB 2667ms 0ms dmd 2.100.2
python 1.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.7
python 2.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.7
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
d 2.d 46ms 0.2ms 1.2MB 40ms 0ms ldc2 1.30.0
d 1.d 46ms 0.7ms 1.2MB 40ms 0ms ldc2 1.30.0
d 1.d 156ms 0.1ms 1.9MB 143ms 0ms dmd 2.100.2
python 2.py 269ms 5.8ms 79.6MB 237ms 13ms pypy 3.8.13
d 2.d 271ms 0.3ms 2.0MB 260ms 0ms dmd 2.100.2
python 1.py 583ms 7.9ms 79.4MB 560ms 3ms pypy 3.8.13
python 1.py 1184ms 11ms 7.2MB 1167ms 0ms pyston 3.8.12
python 2.py 1613ms 7.5ms 8.1MB 1600ms 0ms pyston 3.8.12
python 1.py 4703ms 56ms 7.4MB 4687ms 0ms cpython 3.10.7
python 2.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.7

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 754ms 16ms 43.3MB 733ms 7ms ldc2 1.30.0
d 1.d 832ms 34ms 74.7MB 807ms 7ms dmd 2.100.2
d 2.d 861ms 1.4ms 48.4MB 837ms 7ms ldc2 1.30.0
d 2.d 1636ms 1.4ms 49.4MB 1613ms 7ms dmd 2.100.2
python 1.py 4008ms 8.7ms 391.4MB 3873ms 117ms pypy 3.8.13
python 1.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.7
python 1.py timeout 0.0ms 0.0MB 0ms 0ms pyston 3.8.12

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 129ms 1.0ms 14.5MB 113ms 0ms ldc2 1.30.0
d 1.d 140ms 1.4ms 24.0MB 120ms 3ms dmd 2.100.2
d 2.d 205ms 0.2ms 14.3MB 190ms 0ms ldc2 1.30.0
d 2.d 408ms 0.8ms 16.0MB 393ms 0ms dmd 2.100.2
python 1.py 1030ms 33ms 215.7MB 967ms 40ms pypy 3.8.13
python 1.py 1868ms 12ms 85.9MB 1830ms 17ms pyston 3.8.12
python 1.py 4326ms 5.5ms 85.9MB 4293ms 20ms cpython 3.10.7

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 4.py 2726ms 13ms 119.6MB 2670ms 37ms pypy 3.8.13
python 4.py 2759ms 0.9ms 9.1MB 2723ms 17ms pyston 3.8.12
python 4.py 2767ms 0.5ms 8.6MB 2737ms 17ms cpython 3.10.7
d 1.d 3412ms 6.5ms 7.9MB 3407ms 17ms ldc2 1.30.0
d 1.d timeout 0.0ms 0.0MB 0ms 0ms dmd 2.100.2

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 4.py 653ms 0.8ms 8.8MB 640ms 0ms pyston 3.8.12
python 4.py 660ms 0.3ms 8.3MB 647ms 0ms cpython 3.10.7
python 4.py 684ms 5.3ms 84.5MB 657ms 10ms pypy 3.8.13
d 1.d 807ms 1.8ms 7.8MB 797ms 3ms ldc2 1.30.0
d 1.d 1693ms 8.3ms 8.8MB 1683ms 0ms dmd 2.100.2

secp256k1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 4528ms 9.5ms 8.3MB 4513ms 0ms pyston 3.8.12
python 1.py 4900ms 14ms 87.1MB 4867ms 17ms pypy 3.8.13
d 1.d timeout 0.0ms 0.0MB 0ms 0ms dmd 2.100.2
d 1.d timeout 0.0ms 0.0MB 0ms 0ms ldc2 1.30.0
python 1.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.7

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 1144ms 1.3ms 8.4MB 1130ms 0ms pyston 3.8.12
python 1.py 1375ms 6.1ms 84.2MB 1343ms 13ms pypy 3.8.13
d 1.d 1453ms 4.1ms 3.9MB 1443ms 0ms ldc2 1.30.0
python 1.py 1498ms 22ms 7.3MB 1480ms 0ms cpython 3.10.7
d 1.d 3195ms 3.9ms 5.2MB 3180ms 7ms dmd 2.100.2

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 4595ms 0.9ms 3.8MB 4580ms 0ms ldc2 1.30.0
d 1.d 4782ms 2.0ms 5.0MB 4770ms 0ms dmd 2.100.2
python 8.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.7
python 8.py timeout 0.0ms 0.0MB 0ms 0ms pypy 3.8.13
python 8.py timeout 0.0ms 0.0MB 0ms 0ms pyston 3.8.12

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 1152ms 1.1ms 3.5MB 1140ms 0ms ldc2 1.30.0
d 1.d 1201ms 3.3ms 4.4MB 1187ms 0ms dmd 2.100.2
python 8.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.7
python 8.py timeout 0.0ms 0.0MB 0ms 0ms pypy 3.8.13
python 8.py timeout 0.0ms 0.0MB 0ms 0ms pyston 3.8.12

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 291ms 0.3ms 3.2MB 280ms 0ms ldc2 1.30.0
d 1.d 303ms 0.2ms 4.0MB 290ms 0ms dmd 2.100.2
python 8-m.py 3292ms 24ms 109.1MB 5633ms 357ms pypy 3.8.13
python 8.py timeout 0.0ms 0.0MB 0ms 0ms cpython 3.10.7
python 8.py timeout 0.0ms 0.0MB 0ms 0ms pyston 3.8.12