Go VS D 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
go 1.go 3006ms 7.3ms 46.0MB 4327ms 47ms go 1.19.1
d 1.d 3009ms 27ms 75.1MB 3247ms 0ms ldc2 1.30.0
go 1.go 4239ms 23ms 37.9MB 4220ms 0ms tinygo 0.25.0
d 1.d 4697ms 26ms 124.4MB 4803ms 20ms dmd 2.100.2

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 1.go 259ms 1.5ms 8.1MB 337ms 3ms go 1.19.1
d 1.d 260ms 0.9ms 15.1MB 247ms 0ms ldc2 1.30.0
go 1.go 349ms 0.6ms 6.0MB 340ms 0ms tinygo 0.25.0
d 1.d 390ms 4.8ms 16.3MB 380ms 0ms dmd 2.100.2

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 1-m.go 787ms 149ms 13.6MB 1523ms 3ms go 1.19.1
go 1.go 1694ms 7.1ms 257.2MB 1627ms 53ms tinygo 0.25.0
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

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 1-m.go 57ms 8.6ms 5.4MB 87ms 0ms go 1.19.1
go 1.go 272ms 0.3ms 68.7MB 247ms 10ms tinygo 0.25.0
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
go 1.go 168ms 2.7ms 8.5MB 157ms 0ms go 1.19.1
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
go 1.go 49ms 1.8ms 8.2MB 37ms 0ms go 1.19.1
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

fannkuch-redux

Input: 11

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 3-m.go 1443ms 1.4ms 3.0MB 2800ms 0ms go 1.19.1
go 3.go 2937ms 1.2ms 49.1MB 2913ms 7ms tinygo 0.25.0

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 3-m.go 147ms 2.4ms 3.0MB 223ms 0ms go 1.19.1
go 3.go 314ms 1.1ms 49.9MB 283ms 7ms tinygo 0.25.0

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
go 3-m.go 242ms 1.6ms 2.9MB 440ms 0ms go 1.19.1
d 1.d 770ms 1.1ms 47.8MB 753ms 7ms dmd 2.100.2

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
go 3.go 30ms 0.1ms 2.9MB 40ms 0ms go 1.19.1
d 1.d 81ms 1.0ms 9.9MB 70ms 0ms dmd 2.100.2

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 1.go 1.6ms 0.9ms 0.0MB 0ms 0ms tinygo 0.25.0
d 1.d 2.4ms 0.6ms 2.9MB 0ms 0ms ldc2 1.30.0
go 1.go 2.6ms 0.5ms 2.9MB 0ms 0ms go 1.19.1
d 1.d 2.7ms 0.7ms 4.0MB 0ms 0ms dmd 2.100.2

http-server

Input: 3000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 1-http2.go 172ms 6.5ms 55.9MB 260ms 40ms go 1.19.1
go 2-m.go 551ms 17ms 170.1MB 487ms 367ms go 1.19.1
go 1-m.go 613ms 42ms 165.7MB 613ms 370ms go 1.19.1

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 1-http2.go 31ms 20ms 22.7MB 45ms 5ms go 1.19.1
go 1.go 131ms 9.7ms 38.4MB 73ms 67ms go 1.19.1
go 2.go 135ms 3.5ms 39.1MB 83ms 60ms go 1.19.1

json-serde

Input: sample 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 2-ffi.go 71ms 3.9ms 45.0MB 57ms 3ms go 1.19.1
go 1.go 171ms 1.4ms 18.7MB 157ms 3ms go 1.19.1

Input: canada 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 2-ffi.go 407ms 3.6ms 165.2MB 370ms 113ms go 1.19.1
go 1.go 1043ms 0.4ms 109.0MB 1030ms 47ms go 1.19.1

knucleotide

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 7-m.go 1505ms 5.6ms 42.6MB 2817ms 23ms go 1.19.1

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 7-m.go 224ms 3.0ms 22.4MB 363ms 17ms go 1.19.1

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 3.go 166ms 1.1ms 0.3MB 160ms 0ms tinygo 0.25.0
go 3.go 175ms 0.9ms 2.9MB 160ms 0ms go 1.19.1
d 1.d 179ms 1.5ms 4.0MB 170ms 0ms ldc2 1.30.0
d 1.d 248ms 3.0ms 5.0MB 237ms 0ms dmd 2.100.2

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 3.go 491ms 0.4ms 0.3MB 480ms 0ms tinygo 0.25.0
go 3.go 513ms 2.7ms 3.4MB 500ms 0ms go 1.19.1
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

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
go 3.go 81ms 1.2ms 0.0MB 70ms 0ms tinygo 0.25.0
go 3.go 94ms 1.0ms 3.9MB 83ms 0ms go 1.19.1
d 1.d 108ms 0.9ms 4.6MB 100ms 0ms dmd 2.100.2

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
go 1.go 4105ms 9.6ms 7.3MB 4087ms 3ms go 1.19.1
go 1.go timeout 0.0ms 0.0MB 0ms 0ms tinygo 0.25.0

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
go 1.go 172ms 1.6ms 2.8MB 160ms 0ms go 1.19.1
go 1.go 248ms 4.4ms 0.0MB 240ms 0ms tinygo 0.25.0

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
go 1.go 1976ms 5.3ms 48.1MB 2803ms 43ms go 1.19.1
go 2.go 2305ms 5.9ms 41.3MB 3270ms 43ms go 1.19.1
d 1.d 2635ms 10ms 153.3MB 2933ms 27ms dmd 2.100.2
go 1.go 3286ms 4.0ms 212.1MB 3233ms 33ms tinygo 0.25.0
go 2.go timeout 0.0ms 0.0MB 0ms 0ms tinygo 0.25.0

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
go 1.go 413ms 2.9ms 12.3MB 567ms 13ms go 1.19.1
go 2.go 485ms 2.0ms 13.0MB 663ms 17ms go 1.19.1
d 1.d 542ms 2.3ms 39.8MB 587ms 0ms dmd 2.100.2
go 1.go 792ms 1.5ms 52.1MB 773ms 3ms tinygo 0.25.0
go 2.go 1083ms 3.6ms 39.4MB 1057ms 10ms tinygo 0.25.0

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
go 1.go 455ms 2.1ms 2.9MB 443ms 0ms go 1.19.1
go 1.go 843ms 0.9ms 0.0MB 830ms 0ms tinygo 0.25.0
d 1.d 1533ms 0.2ms 1.9MB 1520ms 0ms dmd 2.100.2
d 2.d 2677ms 1.5ms 2.0MB 2667ms 0ms dmd 2.100.2

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
go 1.go 50ms 1.4ms 2.9MB 40ms 0ms go 1.19.1
go 1.go 88ms 2.5ms 0.0MB 80ms 0ms tinygo 0.25.0
d 1.d 156ms 0.1ms 1.9MB 143ms 0ms dmd 2.100.2
d 2.d 271ms 0.3ms 2.0MB 260ms 0ms dmd 2.100.2

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 2.go 621ms 1.4ms 17.1MB 603ms 0ms tinygo 0.25.0
d 1.d 754ms 16ms 43.3MB 733ms 7ms ldc2 1.30.0
go 1.go 759ms 9.3ms 73.5MB 737ms 10ms go 1.19.1
go 1.go 797ms 15ms 42.5MB 777ms 7ms tinygo 0.25.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
go 2.go 905ms 4.0ms 19.8MB 890ms 7ms go 1.19.1
d 2.d 1636ms 1.4ms 49.4MB 1613ms 7ms dmd 2.100.2

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
go 1.go 129ms 1.0ms 13.6MB 120ms 0ms tinygo 0.25.0
go 1.go 131ms 3.7ms 23.9MB 117ms 3ms go 1.19.1
d 1.d 140ms 1.4ms 24.0MB 120ms 3ms dmd 2.100.2
go 2.go 148ms 1.7ms 5.4MB 140ms 0ms tinygo 0.25.0
d 2.d 205ms 0.2ms 14.3MB 190ms 0ms ldc2 1.30.0
go 2.go 216ms 2.6ms 7.6MB 203ms 0ms go 1.19.1
d 2.d 408ms 0.8ms 16.0MB 393ms 0ms dmd 2.100.2

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 8.go 1424ms 4.4ms 8.5MB 1400ms 7ms go 1.19.1
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
go 8.go 341ms 0.8ms 8.4MB 323ms 3ms go 1.19.1
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

regex-redux

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 3.go timeout 0.0ms 0.0MB 0ms 0ms go 1.19.1
go 3.go timeout 0.0ms 0.0MB 0ms 0ms tinygo 0.25.0

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 3.go 2503ms 23ms 18.2MB 2473ms 33ms go 1.19.1
go 3.go timeout 0.0ms 0.0MB 0ms 0ms tinygo 0.25.0

secp256k1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 0-ffi.go 171ms 1.4ms 7.9MB 157ms 3ms go 1.19.1
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

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 0-ffi.go 56ms 0.2ms 9.6MB 43ms 0ms go 1.19.1
d 1.d 1453ms 4.1ms 3.9MB 1443ms 0ms ldc2 1.30.0
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
go 4-m.go 2511ms 29ms 5.4MB 4843ms 7ms go 1.19.1
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
go 1.go 4887ms 5.0ms 5.5MB 4870ms 3ms go 1.19.1
go 1.go timeout 0.0ms 0.0MB 0ms 0ms tinygo 0.25.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 4-m.go 630ms 0.5ms 4.9MB 1200ms 0ms go 1.19.1
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
go 1.go 1229ms 3.9ms 2.9MB 1213ms 3ms go 1.19.1
go 1.go 2577ms 1.0ms 0.0MB 2560ms 0ms tinygo 0.25.0

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
go 4-m.go 166ms 0.9ms 4.9MB 293ms 0ms go 1.19.1
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
go 1.go 309ms 0.2ms 2.9MB 300ms 0ms go 1.19.1
go 1.go 648ms 0.7ms 0.0MB 637ms 0ms tinygo 0.25.0