C# VS D 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.)

binarytrees

Input: 18

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 1.cs 1400ms 22ms 390.6MB 1260ms 180ms dotnet 6.0.300
csharp 1.cs 2295ms 25ms 103.2MB 2610ms 193ms mono 6.12.0
d 1.d 3150ms 16ms 75.2MB 3393ms 20ms ldc2 1.29.0
d 1.d 4870ms 15ms 124.4MB 4957ms 33ms dmd 2.100.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 1.cs 160ms 4.1ms 44.7MB 143ms 3ms mono 6.12.0
csharp 1.cs 194ms 16ms 93.0MB 140ms 20ms dotnet 6.0.300
d 1.d 276ms 0.6ms 15.0MB 267ms 0ms ldc2 1.29.0
d 1.d 429ms 20ms 15.9MB 413ms 0ms dmd 2.100.0

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 1-m.cs 4355ms 373ms 104.4MB 7393ms 87ms dotnet 6.0.300
d 1.d timeout 0.0ms 0.0MB 0ms 0ms dmd 2.100.0
d 1.d timeout 0.0ms 0.0MB 0ms 0ms ldc2 1.29.0

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 1.cs 410ms 20ms 82.8MB 407ms 47ms dotnet 6.0.300
d 1.d 1302ms 7.1ms 8.4MB 1287ms 3ms ldc2 1.29.0
d 1.d 1665ms 14ms 9.2MB 1650ms 0ms dmd 2.100.0

edigits

Input: 250001

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 3870ms 4.2ms 8.0MB 3860ms 0ms ldc2 1.29.0
d 1.d 4502ms 8.2ms 8.9MB 4483ms 0ms dmd 2.100.0
csharp 1.cs timeout 0.0ms 0.0MB 0ms 0ms dotnet 6.0.300

Input: 100000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 666ms 2.3ms 7.1MB 650ms 0ms ldc2 1.29.0
d 1.d 815ms 0.9ms 8.1MB 800ms 0ms dmd 2.100.0
csharp 1.cs 1112ms 0.9ms 47.9MB 1067ms 13ms dotnet 6.0.300

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 5-m.cs 386ms 15ms 89.8MB 553ms 117ms dotnet 6.0.300
csharp 5-m.cs 493ms 9.8ms 59.0MB 813ms 110ms mono 6.12.0

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 5.cs 90ms 15ms 36.1MB 100ms 33ms mono 6.12.0
csharp 5.cs 99ms 9.1ms 45.3MB 90ms 23ms dotnet 6.0.300

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 2.3ms 0.5ms 2.9MB 0ms 0ms ldc2 1.29.0
d 1.d 2.6ms 0.5ms 4.1MB 0ms 0ms dmd 2.100.0
csharp 1.cs 19ms 0.4ms 24.3MB 10ms 0ms mono 6.12.0
csharp 1.cs 50ms 4.7ms 32.9MB 24ms 2ms dotnet 6.0.300

http-server

Input: 3000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 2-http2.cs 662ms 13ms 120.7MB 753ms 77ms dotnet 6.0.300
csharp 2.cs 856ms 17ms 159.7MB 723ms 460ms dotnet 6.0.300
csharp 1-m.cs 884ms 50ms 151.7MB 923ms 407ms dotnet 6.0.300

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 2.cs 462ms 13ms 80.6MB 373ms 110ms dotnet 6.0.300
csharp 1.cs 494ms 12ms 89.7MB 483ms 123ms dotnet 6.0.300
csharp 2-http2.cs 522ms 2.0ms 83.1MB 543ms 33ms dotnet 6.0.300

json-serde

Input: sample 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 2.cs 350ms 7.5ms 67.9MB 313ms 23ms dotnet 6.0.300
csharp 1.cs 530ms 6.0ms 146.6MB 507ms 53ms dotnet 6.0.300

Input: canada 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 2.cs 2029ms 17ms 267.6MB 2117ms 100ms dotnet 6.0.300
csharp 1.cs 3283ms 134ms 761.6MB 3160ms 380ms dotnet 6.0.300

knucleotide

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 6.cs 1349ms 172ms 78.1MB 1697ms 40ms dotnet 6.0.300
csharp 6-m.cs 1608ms 60ms 71.9MB 2610ms 23ms mono 6.12.0

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 6.cs 237ms 6.1ms 66.0MB 250ms 23ms dotnet 6.0.300
csharp 6.cs 251ms 7.8ms 52.7MB 333ms 10ms mono 6.12.0

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 180ms 1.0ms 4.2MB 170ms 0ms ldc2 1.29.0
csharp 2.cs 187ms 1.3ms 25.5MB 170ms 0ms mono 6.12.0
csharp 2.cs 208ms 4.7ms 28.0MB 170ms 0ms dotnet 6.0.300
d 1.d 247ms 0.6ms 5.0MB 237ms 0ms dmd 2.100.0
csharp 1.cs 1670ms 5.3ms 91.7MB 1620ms 37ms dotnet 6.0.300
csharp 1.cs 3070ms 3.0ms 49.8MB 3023ms 37ms mono 6.12.0

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 2.cs 457ms 3.5ms 28.1MB 427ms 3ms dotnet 6.0.300
csharp 2.cs 511ms 13ms 24.4MB 497ms 0ms mono 6.12.0
d 1.d 532ms 5.1ms 4.1MB 527ms 0ms ldc2 1.29.0
d 1.d 731ms 4.4ms 4.9MB 723ms 0ms dmd 2.100.0
csharp 1.cs 4722ms 92ms 92.7MB 4683ms 27ms dotnet 6.0.300
csharp 1.cs timeout 0.0ms 0.0MB 0ms 0ms mono 6.12.0

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 78ms 2.4ms 3.8MB 67ms 0ms ldc2 1.29.0
csharp 2.cs 107ms 1.5ms 27.3MB 93ms 0ms mono 6.12.0
d 1.d 109ms 1.2ms 4.5MB 100ms 0ms dmd 2.100.0
csharp 2.cs 130ms 4.5ms 27.7MB 103ms 0ms dotnet 6.0.300
csharp 1.cs 3190ms 8.7ms 33.8MB 3163ms 3ms mono 6.12.0
csharp 1.cs 3201ms 7.3ms 73.2MB 3160ms 20ms dotnet 6.0.300

mandelbrot

Input: 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 2.cs 1289ms 18ms 94.2MB 1220ms 40ms dotnet 6.0.300
csharp 3.cs 4409ms 23ms 98.9MB 4353ms 33ms dotnet 6.0.300
csharp 1.cs timeout 0.0ms 0.0MB 0ms 0ms dotnet 6.0.300
csharp 1.cs timeout 0.0ms 0.0MB 0ms 0ms mono 6.12.0

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 2.cs 146ms 5.0ms 68.2MB 77ms 30ms dotnet 6.0.300
csharp 3.cs 296ms 2.4ms 62.3MB 260ms 13ms dotnet 6.0.300
csharp 1.cs 1762ms 21ms 94.1MB 1713ms 30ms dotnet 6.0.300
csharp 1.cs 3330ms 5.6ms 34.2MB 3307ms 10ms mono 6.12.0

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 2.cs 908ms 3.1ms 378.4MB 773ms 167ms dotnet 6.0.300
csharp 1.cs 922ms 7.6ms 395.6MB 780ms 173ms dotnet 6.0.300
d 1.d 1501ms 10.0ms 75.0MB 1557ms 10ms ldc2 1.29.0
csharp 1.cs 1729ms 34ms 153.0MB 2073ms 143ms mono 6.12.0
d 1.d 2707ms 39ms 153.2MB 3007ms 30ms dmd 2.100.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 2.cs 253ms 3.7ms 94.1MB 203ms 30ms dotnet 6.0.300
csharp 1.cs 284ms 3.0ms 183.8MB 197ms 67ms dotnet 6.0.300
d 1.d 297ms 1.7ms 39.1MB 277ms 7ms ldc2 1.29.0
csharp 1.cs 315ms 3.6ms 74.8MB 283ms 40ms mono 6.12.0
d 1.d 561ms 8.2ms 39.9MB 600ms 3ms dmd 2.100.0

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 425ms 0.5ms 1.2MB 413ms 0ms ldc2 1.29.0
d 2.d 435ms 0.1ms 1.2MB 423ms 0ms ldc2 1.29.0
csharp 9.cs 438ms 9.0ms 29.3MB 410ms 0ms dotnet 6.0.300
csharp 8.cs 537ms 3.7ms 29.1MB 503ms 3ms dotnet 6.0.300
csharp 8.cs 1110ms 1.7ms 27.0MB 1097ms 0ms mono 6.12.0
d 1.d 1534ms 0.6ms 2.0MB 1520ms 0ms dmd 2.100.0
d 2.d 2691ms 0.8ms 1.9MB 2680ms 0ms dmd 2.100.0

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 45ms 0.3ms 1.2MB 37ms 0ms ldc2 1.29.0
d 2.d 47ms 0.2ms 1.2MB 37ms 0ms ldc2 1.29.0
csharp 9.cs 95ms 4.6ms 29.2MB 67ms 0ms dotnet 6.0.300
csharp 8.cs 101ms 4.9ms 31.2MB 77ms 0ms dotnet 6.0.300
csharp 8.cs 135ms 4.1ms 27.0MB 123ms 0ms mono 6.12.0
d 1.d 156ms 0.1ms 1.9MB 150ms 0ms dmd 2.100.0
d 2.d 277ms 3.8ms 2.0MB 267ms 0ms dmd 2.100.0

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 2.d 886ms 2.5ms 48.7MB 857ms 17ms ldc2 1.29.0
csharp 1.cs 910ms 19ms 88.6MB 880ms 17ms mono 6.12.0
csharp 1.cs 960ms 29ms 87.9MB 910ms 20ms dotnet 6.0.300
d 1.d 971ms 78ms 43.4MB 950ms 10ms ldc2 1.29.0
csharp 2.cs 1031ms 0.9ms 40.1MB 993ms 7ms dotnet 6.0.300
d 1.d 1078ms 24ms 75.3MB 1053ms 10ms dmd 2.100.0
d 2.d 1640ms 1.6ms 49.8MB 1623ms 0ms dmd 2.100.0
csharp 2.cs 2587ms 3.8ms 32.5MB 2577ms 0ms mono 6.12.0

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 131ms 2.2ms 14.4MB 117ms 3ms ldc2 1.29.0
d 1.d 139ms 1.9ms 22.9MB 123ms 0ms dmd 2.100.0
csharp 1.cs 185ms 0.6ms 40.7MB 173ms 3ms mono 6.12.0
csharp 1.cs 187ms 4.3ms 45.9MB 153ms 7ms dotnet 6.0.300
d 2.d 213ms 1.1ms 15.5MB 193ms 0ms ldc2 1.29.0
csharp 2.cs 301ms 3.8ms 31.7MB 273ms 0ms dotnet 6.0.300
d 2.d 408ms 0.8ms 16.0MB 393ms 3ms dmd 2.100.0
csharp 2.cs 644ms 0.3ms 25.9MB 630ms 0ms mono 6.12.0

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 3485ms 6.2ms 7.9MB 3463ms 33ms ldc2 1.29.0
csharp 1.cs timeout 0.0ms 0.0MB 0ms 0ms dotnet 6.0.300
d 1.d timeout 0.0ms 0.0MB 0ms 0ms dmd 2.100.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 824ms 0.5ms 7.8MB 817ms 0ms ldc2 1.29.0
csharp 1.cs 1281ms 9.1ms 90.8MB 1277ms 30ms dotnet 6.0.300
d 1.d 1694ms 6.5ms 8.9MB 1683ms 0ms dmd 2.100.0

regex-redux

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 5.cs 3271ms 13ms 592.6MB 3217ms 230ms dotnet 7.0.100
csharp 5p.cs 3951ms 19ms 590.4MB 3800ms 233ms dotnet 7.0.100
csharp 5.cs 4122ms 67ms 525.8MB 4037ms 210ms dotnet 6.0.300

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 5.cs 481ms 24ms 162.1MB 410ms 47ms dotnet 7.0.100
csharp 5.cs 536ms 3.8ms 88.8MB 493ms 30ms dotnet 6.0.300
csharp 5p.cs 572ms 13ms 156.9MB 470ms 50ms dotnet 7.0.100

secp256k1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 1.cs 4316ms 16ms 90.5MB 4300ms 27ms dotnet 6.0.300

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 1.cs 1164ms 13ms 88.3MB 1157ms 13ms dotnet 6.0.300

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 3-m.cs 2999ms 510ms 30.9MB 5187ms 20ms dotnet 6.0.300
d 1.d 4667ms 0.7ms 3.8MB 4660ms 0ms ldc2 1.29.0
d 1.d 4783ms 1.0ms 4.5MB 4763ms 0ms dmd 2.100.0
csharp 3.cs timeout 0.0ms 0.0MB 0ms 0ms mono 6.12.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 3-m.cs 719ms 3.7ms 29.5MB 1297ms 13ms dotnet 6.0.300
d 1.d 1171ms 1.1ms 3.5MB 1160ms 0ms ldc2 1.29.0
d 1.d 1199ms 0.4ms 4.4MB 1190ms 0ms dmd 2.100.0
csharp 3-m.cs 3181ms 129ms 29.4MB 6040ms 10ms mono 6.12.0

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 3-m.cs 235ms 3.5ms 30.1MB 360ms 3ms dotnet 6.0.300
d 1.d 297ms 2.2ms 3.3MB 280ms 0ms ldc2 1.29.0
d 1.d 303ms 0.4ms 4.1MB 287ms 0ms dmd 2.100.0
csharp 3-m.cs 805ms 2.5ms 30.0MB 1530ms 3ms mono 6.12.0