D VS C 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
d 1.d 1731ms 13ms 312.7MB 1683ms 53ms ldc2 1.40.0
d 1.d 2697ms 37ms 314.8MB 2887ms 70ms dmd 2.109.1

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 164ms 0.9ms 209.0MB 130ms 20ms ldc2 1.40.0
d 1.d 230ms 1.4ms 210.2MB 200ms 13ms dmd 2.109.1

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d timeout 0.0ms 16.8MB 4957ms 27ms dmd 2.109.1
d 1.d timeout 0.0ms 15.1MB 4957ms 23ms ldc2 1.40.0

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 996ms 8.5ms 8.5MB 973ms 10ms ldc2 1.40.0
d 1.d 1307ms 3.5ms 12.6MB 1287ms 10ms dmd 2.109.1

edigits

Input: 250001

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 2543ms 2.7ms 8.0MB 2533ms 0ms ldc2 1.40.0
d 1.d 2918ms 8.7ms 10.2MB 2900ms 3ms dmd 2.109.1

Input: 100000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 440ms 1.8ms 8.1MB 423ms 0ms ldc2 1.40.0
d 1.d 532ms 1.9ms 10.2MB 520ms 0ms dmd 2.109.1

fannkuch-redux

Input: 11

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1-im.d 376ms 8.5ms 3.0MB 1413ms 0ms ldc2 1.40.0
d 2-im.d 1116ms 1.7ms 6.9MB 4283ms 0ms ldc2 1.40.0
d 1-i.d 1478ms 1.3ms 2.8MB 1467ms 0ms ldc2 1.40.0
d 1.d 3119ms 18ms 2.8MB 3107ms 0ms ldc2 1.40.0
d 2-i.d 3221ms 2.9ms 2.9MB 3207ms 0ms ldc2 1.40.0
d 1.d 3509ms 8.3ms 4.6MB 3497ms 0ms dmd 2.109.1
d 1-im.d 4230ms 23ms 8.9MB 16527ms 10ms dmd 2.109.1
d 1-i.d timeout 0.0ms 4.4MB 4990ms 0ms dmd 2.109.1
d 2-i.d timeout 0.0ms 4.5MB 4990ms 0ms dmd 2.109.1
d 2-im.d timeout 0.0ms 6.9MB 19703ms 7ms dmd 2.109.1

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1-im.d 39ms 2.0ms 5.2MB 110ms 0ms ldc2 1.40.0
d 2-im.d 98ms 2.3ms 5.1MB 340ms 0ms ldc2 1.40.0
d 1-i.d 123ms 0.3ms 2.8MB 110ms 0ms ldc2 1.40.0
d 1.d 263ms 4.5ms 2.9MB 253ms 0ms ldc2 1.40.0
d 2-i.d 266ms 0.6ms 2.8MB 260ms 0ms ldc2 1.40.0
d 1.d 294ms 1.7ms 4.6MB 283ms 0ms dmd 2.109.1
d 1-im.d 356ms 2.8ms 6.9MB 1343ms 0ms dmd 2.109.1
d 2-im.d 531ms 1.3ms 8.7MB 1987ms 3ms dmd 2.109.1
d 1-i.d 865ms 4.8ms 4.5MB 857ms 0ms dmd 2.109.1
d 2-i.d 1381ms 9.1ms 4.5MB 1367ms 0ms dmd 2.109.1

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 196ms 2.2ms 49.3MB 180ms 3ms ldc2 1.40.0
d 1.d 624ms 2.2ms 49.0MB 600ms 13ms dmd 2.109.1

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 24ms 0.8ms 10.5MB 13ms 0ms ldc2 1.40.0
d 1.d 66ms 0.7ms 12.1MB 57ms 0ms dmd 2.109.1

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 1.c 1.0ms 0.0ms 1.4MB 0ms 0ms zigcc 0.13.0
c 1.c 1.3ms 0.1ms 2.1MB 0ms 0ms gcc 14.2.0
c 1.c 1.4ms 0.2ms 2.1MB 0ms 0ms clang 14.0.0-1ubuntu1.1
d 1.d 1.7ms 0.1ms 3.0MB 0ms 0ms ldc2 1.40.0
d 1.d 2.1ms 0.2ms 5.0MB 0ms 0ms dmd 2.109.1

json-serde

Input: sample 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 2.d 62ms 8.4ms 15.8MB 67ms 23ms ldc2 1.40.0
d 2.d 241ms 2.5ms 22.3MB 243ms 7ms dmd 2.109.1

Input: canada 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 2.d 448ms 0.8ms 141.6MB 423ms 23ms ldc2 1.40.0
d 2.d 2511ms 5.7ms 158.2MB 2523ms 40ms dmd 2.109.1

knucleotide

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 1-m.c 175ms 2.8ms 26.5MB 410ms 10ms gcc 14.2.0
c 1-m.c 303ms 7.0ms 27.7MB 1030ms 30ms clang 14.0.0-1ubuntu1.1
d 1-m.d 613ms 9.9ms 52.0MB 2063ms 13ms ldc2 1.40.0
d 1-m.d 1907ms 52ms 54.1MB 5930ms 13ms dmd 2.109.1

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 1-m.c 28ms 1.2ms 12.8MB 63ms 0ms gcc 14.2.0
c 1-m.c 37ms 0.9ms 14.9MB 107ms 3ms clang 14.0.0-1ubuntu1.1
d 1-m.d 82ms 1.6ms 39.7MB 227ms 3ms ldc2 1.40.0
d 1-m.d 209ms 8.1ms 44.9MB 597ms 13ms dmd 2.109.1

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 129ms 11ms 4.1MB 117ms 23ms ldc2 1.40.0
d 1.d 179ms 1.3ms 7.9MB 173ms 0ms dmd 2.109.1

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 365ms 1.8ms 5.8MB 353ms 13ms ldc2 1.40.0
d 1.d 533ms 24ms 7.9MB 517ms 60ms dmd 2.109.1

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 54ms 1.8ms 6.1MB 43ms 7ms ldc2 1.40.0
d 1.d 79ms 0.6ms 8.2MB 67ms 3ms dmd 2.109.1

mandelbrot

Input: 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 1-mffi.c 216ms 7.9ms 7.6MB 807ms 3ms clang 14.0.0-1ubuntu1.1
d 1.d 293ms 0.5ms 7.4MB 280ms 0ms ldc2 1.40.0
c 1-mffi.c 320ms 45ms 6.6MB 910ms 0ms gcc 14.2.0
c 1-ffi.c 431ms 1.2ms 6.0MB 417ms 0ms zigcc unknown
c 1-mffi.c 432ms 3.3ms 6.0MB 423ms 0ms zigcc unknown
c 1-ffi.c 455ms 4.1ms 6.7MB 440ms 0ms clang 14.0.0-1ubuntu1.1
c 1-ffi.c 540ms 3.5ms 6.8MB 533ms 0ms gcc 14.2.0
d 1.d 2341ms 408ms 9.2MB 2330ms 0ms dmd 2.109.1

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 15ms 0.1ms 3.0MB 10ms 0ms ldc2 1.40.0
c 1-mffi.c 17ms 1.4ms 8.5MB 30ms 0ms clang 14.0.0-1ubuntu1.1
c 1-ffi.c 20ms 0.2ms 3.0MB 10ms 0ms zigcc unknown
c 1-mffi.c 20ms 0.1ms 3.0MB 10ms 0ms zigcc unknown
c 1-ffi.c 22ms 0.4ms 3.6MB 10ms 0ms clang 14.0.0-1ubuntu1.1
c 1-mffi.c 23ms 0.8ms 5.8MB 60ms 0ms gcc 14.2.0
c 1-ffi.c 26ms 1.4ms 3.5MB 13ms 0ms gcc 14.2.0
d 1.d 94ms 7.3ms 4.5MB 83ms 0ms dmd 2.109.1

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 936ms 4.9ms 312.4MB 903ms 30ms ldc2 1.40.0
d 1.d 1744ms 6.1ms 314.0MB 1877ms 40ms dmd 2.109.1

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 193ms 0.4ms 312.7MB 150ms 30ms ldc2 1.40.0
d 1.d 343ms 6.6ms 314.8MB 290ms 43ms dmd 2.109.1

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 8-i.c 246ms 1.1ms 1.5MB 233ms 0ms zigcc 0.13.0
c 5.c 298ms 0.5ms 1.5MB 290ms 0ms zigcc 0.13.0
c 8-i.c 300ms 0.7ms 2.1MB 290ms 0ms clang 14.0.0-1ubuntu1.1
c 2.c 309ms 1.2ms 2.3MB 300ms 0ms gcc 14.2.0
c 2.c 311ms 1.6ms 1.5MB 300ms 0ms zigcc 0.13.0
c 5.c 311ms 0.5ms 2.3MB 300ms 0ms gcc 14.2.0
c 5.c 314ms 1.7ms 2.1MB 310ms 0ms clang 14.0.0-1ubuntu1.1
c 2.c 325ms 14ms 2.1MB 313ms 0ms clang 14.0.0-1ubuntu1.1
c 8-i.c 332ms 1.3ms 2.3MB 320ms 0ms gcc 14.2.0
d 1.d 359ms 0.2ms 2.9MB 347ms 0ms ldc2 1.40.0
d 2.d 359ms 1.7ms 2.9MB 350ms 0ms ldc2 1.40.0
d 1.d 678ms 2.0ms 4.6MB 670ms 0ms dmd 2.109.1
d 2.d 2007ms 1.9ms 4.6MB 1997ms 0ms dmd 2.109.1

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 8-i.c 27ms 0.5ms 1.5MB 20ms 0ms zigcc 0.13.0
c 5.c 32ms 0.4ms 1.5MB 20ms 0ms zigcc 0.13.0
c 8-i.c 33ms 0.6ms 2.1MB 23ms 0ms clang 14.0.0-1ubuntu1.1
c 5.c 33ms 0.0ms 2.3MB 27ms 0ms gcc 14.2.0
c 2.c 33ms 0.4ms 2.3MB 23ms 0ms gcc 14.2.0
c 2.c 34ms 0.3ms 1.5MB 27ms 0ms zigcc 0.13.0
c 5.c 34ms 0.5ms 2.1MB 23ms 0ms clang 14.0.0-1ubuntu1.1
c 8-i.c 35ms 0.1ms 2.3MB 27ms 0ms gcc 14.2.0
c 2.c 35ms 1.7ms 2.1MB 23ms 0ms clang 14.0.0-1ubuntu1.1
d 1.d 38ms 0.3ms 2.9MB 30ms 0ms ldc2 1.40.0
d 2.d 39ms 0.4ms 2.9MB 30ms 0ms ldc2 1.40.0
d 1.d 71ms 0.4ms 4.6MB 60ms 0ms dmd 2.109.1
d 2.d 205ms 1.6ms 4.6MB 193ms 0ms dmd 2.109.1

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 1.c 266ms 8.2ms 40.9MB 250ms 0ms gcc 14.2.0
c 1.c 273ms 3.6ms 40.8MB 257ms 0ms clang 14.0.0-1ubuntu1.1
d 1.d 298ms 6.7ms 43.7MB 280ms 3ms ldc2 1.40.0
c 1.c 303ms 15ms 40.3MB 287ms 3ms zigcc 0.13.0
d 1.d 337ms 2.8ms 75.9MB 323ms 3ms dmd 2.109.1
d 2.d 836ms 2.2ms 47.7MB 817ms 0ms ldc2 1.40.0
d 2.d 1166ms 1.4ms 49.3MB 1157ms 0ms dmd 2.109.1

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 1.c 50ms 1.3ms 11.5MB 33ms 0ms clang 14.0.0-1ubuntu1.1
c 1.c 53ms 5.0ms 11.6MB 40ms 0ms gcc 14.2.0
d 1.d 60ms 1.2ms 13.7MB 47ms 0ms ldc2 1.40.0
c 1.c 60ms 2.8ms 11.0MB 47ms 0ms zigcc 0.13.0
d 1.d 68ms 3.1ms 24.2MB 57ms 0ms dmd 2.109.1
d 2.d 206ms 0.3ms 15.7MB 197ms 0ms ldc2 1.40.0
d 2.d 294ms 3.9ms 17.8MB 280ms 3ms dmd 2.109.1

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 2415ms 28ms 8.1MB 2357ms 390ms ldc2 1.40.0
d 1.d 4385ms 39ms 10.2MB 4327ms 443ms dmd 2.109.1

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 578ms 2.5ms 8.1MB 563ms 87ms ldc2 1.40.0
d 1.d 1035ms 2.8ms 10.2MB 1027ms 90ms dmd 2.109.1

regex-redux

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 3.d 573ms 1.4ms 170.7MB 757ms 23ms ldc2 1.40.0
d 3.d 1353ms 48ms 173.3MB 1570ms 20ms dmd 2.109.1

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 3.d 66ms 4.3ms 24.3MB 80ms 3ms ldc2 1.40.0
d 3.d 142ms 4.7ms 26.8MB 147ms 3ms dmd 2.109.1

secp256k1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 4768ms 14ms 4.3MB 4717ms 367ms ldc2 1.40.0
d 1.d timeout 0.0ms 6.5MB 4950ms 277ms dmd 2.109.1

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 1188ms 1.9ms 4.0MB 1173ms 80ms ldc2 1.40.0
d 1.d 2046ms 7.7ms 6.6MB 2047ms 83ms dmd 2.109.1

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 6-im.c 959ms 3.7ms 4.1MB 3763ms 0ms gcc 14.2.0
c 4-m.c 963ms 1.3ms 4.1MB 3777ms 0ms gcc 14.2.0
c 6-im.c 1014ms 27ms 7.2MB 3937ms 13ms clang 14.0.0-1ubuntu1.1
c 5-im.c 1092ms 4.2ms 4.1MB 4290ms 0ms gcc 14.2.0
c 4-m.c 1118ms 3.5ms 7.3MB 4377ms 3ms clang 14.0.0-1ubuntu1.1
c 5-im.c 1329ms 4.7ms 5.3MB 5207ms 3ms clang 14.0.0-1ubuntu1.1
c 3-m.c 1873ms 45ms 5.3MB 7227ms 20ms clang 14.0.0-1ubuntu1.1
c 3-m.c 1974ms 7.7ms 4.1MB 7773ms 0ms gcc 14.2.0
d 1.d 3582ms 2.7ms 4.0MB 3567ms 0ms ldc2 1.40.0
d 1.d 3602ms 9.7ms 8.5MB 3590ms 0ms dmd 2.109.1

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 6-im.c 248ms 1.1ms 4.0MB 947ms 0ms gcc 14.2.0
c 4-m.c 254ms 1.5ms 4.0MB 967ms 0ms gcc 14.2.0
c 6-im.c 259ms 0.3ms 5.3MB 977ms 0ms clang 14.0.0-1ubuntu1.1
c 5-im.c 287ms 5.1ms 4.0MB 1090ms 0ms gcc 14.2.0
c 4-m.c 288ms 0.9ms 5.1MB 1087ms 3ms clang 14.0.0-1ubuntu1.1
c 5-im.c 340ms 1.6ms 7.3MB 1303ms 0ms clang 14.0.0-1ubuntu1.1
c 3-m.c 471ms 13ms 5.4MB 1797ms 3ms clang 14.0.0-1ubuntu1.1
c 3-m.c 511ms 13ms 4.0MB 1970ms 0ms gcc 14.2.0
d 1.d 897ms 2.4ms 3.7MB 887ms 0ms ldc2 1.40.0
d 1.d 908ms 0.9ms 5.3MB 900ms 0ms dmd 2.109.1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
c 6-im.c 72ms 3.3ms 4.0MB 247ms 0ms gcc 14.2.0
c 6-im.c 72ms 1.3ms 7.1MB 247ms 0ms clang 14.0.0-1ubuntu1.1
c 4-m.c 77ms 9.0ms 4.0MB 263ms 0ms gcc 14.2.0
c 4-m.c 80ms 0.5ms 5.1MB 273ms 0ms clang 14.0.0-1ubuntu1.1
c 5-im.c 81ms 2.6ms 4.0MB 287ms 0ms gcc 14.2.0
c 5-im.c 92ms 0.5ms 5.2MB 317ms 3ms clang 14.0.0-1ubuntu1.1
c 3-m.c 129ms 7.0ms 5.1MB 460ms 0ms clang 14.0.0-1ubuntu1.1
c 3-m.c 135ms 1.0ms 4.0MB 500ms 0ms gcc 14.2.0
d 1.d 227ms 0.4ms 3.1MB 217ms 0ms ldc2 1.40.0
d 1.d 231ms 2.6ms 5.1MB 220ms 0ms dmd 2.109.1