D perfomance

Guillaume Piolat first.last at gmail.com
Wed Apr 22 16:23:58 UTC 2020


On Wednesday, 22 April 2020 at 14:00:10 UTC, serge wrote:
> My understanding that D is the language in similar ballpark 
> performance league as C, C++, Rust.

Yes.

If you have time to optimize: there is preciously little 
difference speed-wise between native languages.

Every native language using the same backend end up in the same 
ballbark, with tricks to get the code to the same baseline.

The last percents wille be due to different handling of UB, 
integer overflow, aliasing... but in general the ethos of native 
language is to allow you to reach top native speed and in the end 
they will generate the exact same code.


But, if your application is barely optimized, or more likely you 
don't have time to optimize properly, it becomes a bit more 
interesting. Defaults will matter a lot more and things like GC, 
whether the langage encourages copies, and the "idiomatic" style 
that is accepted will start to bear consequences (and even more 
so: libraries). This is what end up in benchmarks, but if the 
application was worth optimizing for it (in terms of added value) 
it would be optimized hard to get to that native ceiling.

In short, the less useful an application is, the more it will 
display large differences between languages with similar 
low-level capabilities.


It would be much more interesting to compare _backends_, but 
people keep comparing front-ends because it drives traffic and 
commentary.



More information about the Digitalmars-d mailing list