Is D slow?

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jun 9 11:32:06 PDT 2017


On 6/9/17 12:21 PM, Honey wrote:
> Hi guys,
>
> I wrote a toy benchmark in C++ [1] and tried to literally translate it
> to D [2].

Wow, so that's how D code would look like if it were C++ :)

>
> The results are quite disappointing. What seems particularly strange to
> me is that -boundscheck=off leads to a performance decrease.

That doesn't make much sense, but I'm not an ldc2 user. However, it does 
note in the help that -release disables bounds checks already.

I did replicate that issue on my box, and mucking around with the 
implementation didn't help.

In answer to the subject, no D is not slow. However, it's quite possible 
that std.algorithm.bringToFront is slower than std::rotate, or 
SortedRange.upperBound is slower than std::upper_bound, or both. I don't 
think it's a design issue per se, probably more of an implementation issue.

-Steve


More information about the Digitalmars-d-learn mailing list