Benchmark of D against other languages

weaselcat via Digitalmars-d digitalmars-d at puremagic.com
Tue Mar 31 19:17:27 PDT 2015


On Tuesday, 31 March 2015 at 23:53:07 UTC, weaselcat wrote:
> On Tuesday, 31 March 2015 at 18:20:05 UTC, cym13 wrote:
>> I found this repository (reddit!) that hosts common benchmarks 
>> for many languages such as D, Nim, Go, python, C, etc... It 
>> uses only standard structures not to influence the benchmark.
>>
>> https://github.com/kostya/benchmarks
>
> dmd in benchmark => worthless
> there really needs to be a big red warning that dmd is just the 
> reference implementation and use LDC/GDC for performance.

all this benchmark made me realize is that other languages and 
compilers are dog slow.

Removed everything except ruby, crystal, C, CPP, nim, and D(dmd 
and ldc), and go to save myself time. The rust version the code 
is for is outdated, so I couldn't do rust.

base64

Crystal
encode: 1333333600, 00:00:01.2094060
decode: 1000000000, 00:00:02.4451890
3.66s, 60.4Mb
Go
encode: 1333333600, 4.6449
decode: 1000000000, 20.7173
25.38s, 94.7Mb
Cpp
encode: 1333333600, 4.54
decode: 1000000000, 3.69
8.31s, 67.5Mb
C
encode: 1333333600, 1.19
decode: 1000000000, 2.58
3.78s, 32.8Mb
D - DMD
encode: 1333333600, 1.911
decode: 1000000000, 6.041
7.96s, 89.5Mb
D - LDC
encode: 1333333600, 1.677
decode: 1000000000, 1.916
3.61s, 53.4Mb
D - GDC
encode: 1333333600, 1.319
decode: 1000000000, 2.065
3.40s, 46.7Mb
Nim
encode: 1368421200, 1.77194
decode: 1000000000, 2.78278
4.56s, 101.9Mb
Ruby
encode: 1333333600, 1.69567271
decode: 1000000000, 1.837302336
3.57s, 130.3Mb

winner: GDC

Crystal
ZYXWVUTSRQPONMLKJIHGFEDCBA
8.02s, 2.1Mb
Go
ZYXWVUTSRQPONMLKJIHGFEDCBA
9.57s, 1.7Mb
Cpp
ZYXWVUTSRQPONMLKJIHGFEDCBA
5.81s, 1.3Mb
D
ZYXWVUTSRQPONMLKJIHGFEDCBA
10.01s, 2.4Mb
D - LDC
ZYXWVUTSRQPONMLKJIHGFEDCBA
6.56s, 9.2Mb
D - GDC
ZYXWVUTSRQPONMLKJIHGFEDCBA
7.40s, 2.4Mb
Nim Gcc
ZYXWVUTSRQPONMLKJIHGFEDCBA
4.68s, 1.5Mb
Nim Clang
ZYXWVUTSRQPONMLKJIHGFEDCBA
3.68s, 1.4Mb
Ruby
40+ seconds at third letter, ctrl-c

winner: nim clang
notes: LDC's memory usage??

json:
test file is missing?

matmul:
Crystal
-143.5
5.88s, 73.1Mb
Go
-143.500167
5.95s, 76.6Mb
C
-143.500167
5.36s, 69.6Mb
D
-143.500167
5.50s, 72.5Mb
LDC
-143.500167
4.97s, 80.9Mb
GDC
-143.500167
4.32s, 74.4Mb
Nim
-143.50017
5.77s, 133.8Mb
Ruby
ctrl-c after a couple minutes

winner: D gdc

LDC flags: -O5 -release -inline -boundscheck=off
GDC flags: -O3 -frelease -finline -fno-bounds-check

posting this knowing that andrei is about to yell at me for not 
posting this in the reddit thread ;)


More information about the Digitalmars-d mailing list