On Sunday, 13 August 2017 at 06:09:39 UTC, amfvcg wrote:
Hi all,
I'm solving below task:
given container T and value R return sum of R-ranges over T. An
example:
input : T=[1,1,1] R=2
output : [2, 1]
input : T=[1,2,3] R=1
output : [1,2,3]
(see dlang unittests for more examples)
Below c++ code compiled with g++-5.4.0 -O2 -std=c++14 runs on
my machine in 656 836 us.
Below D code compiled with dmd v2.067.1 -O runs on my machine
in ~ 14.5 sec.
If I had to guess, this could be due to backend and optimizer.
I don't want to go in to detail on my thoughts because I am not
an expert
on codegen optimization, but I might suggest running your test
compiled with
GDC (using identical optimization settings as G++) and ldc2 with
similar settings.