On Tue, Jan 17, 2023 at 11:08:19PM +0000, Siarhei Siamashka via Digitalmars-d-learn wrote: > 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.
Interesting, I didn't know GDC has issues with inlining. I thought it was more-or-less on par with LDC in terms of the quality of code generation. Do you have a concrete example of this problem? > 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. [...] For anything performance related, I wouldn't even consider DMD. For all the 10+ years I've been using D, it has consistently produced executables that run about 20-30% slower than those produced by LDC or GDC, sometimes even up to 40%. For script-like programs or interactive apps that don't care about performance, DMD is fine for convenience and fast compile turnaround times. But as soon as performance matters, DMD is not even on my radar. T -- Heuristics are bug-ridden by definition. If they didn't have bugs, they'd be algorithms.