Coding Challenges - Dlang or Generic

Siarhei Siamashka siarhei.siamashka at gmail.com
Tue Jan 17 23:08:19 UTC 2023


On Tuesday, 17 January 2023 at 21:50:06 UTC, matheus wrote:
> Question: Have you compared the timings between this way (With 
> ranges) and a normal way (Without ranges)?

If you are intensively using ranges, UFCS or the other convenient 
high level language features, then the compiler choice does 
matter a lot. And only LDC compiler is able to produce fast 
binaries from such source code.

GDC compiler has severe performance problems with inlining, 
unless LTO is enabled. And it also allocates closures on stack. 
This may or may not be fixed in the future, but today I can't 
recommend GDC if you really care about performance.

DMD compiler uses an outdated code generation backend from 
Digital Mars C++ and will never be able to produce fast binaries. 
It prioritizes fast compilation speed over everything else.

> I'm using D Online Compiler from different platforms but 
> unfortunately I can't loop too much because they don't accept, 
> but anyway a normal version runs almost twice faster than this 
> version (With ranges).

Can you try to run the following diagnostics program on this D 
Online Compiler platform? 
https://gist.github.com/ssvb/5c926ed9bc755900fdaac3b71a0f7cfd

> If you like I could send or post here a version without ranges 
> to try out.

Please post it. This is interesting.


More information about the Digitalmars-d-learn mailing list