On Friday, 23 February 2018 at 20:15:12 UTC, H. S. Teoh wrote:
Now that I got your attention:


tl;dr: A trivial piece of code, written as ostensibly "idiomatic D" with std.algorithm and std.range templates, compiles *an order of magnitude* slower than the equivalent hand-written loop. The way the compiler compiles templates needs some serious improvement.

(And this is why our current fast-fast-fast slogan annoys me so much. One can argue that it's misleading advertising, given that what's considered "idiomatic D", using features like templates and generic code that's highly-touted as D's strong points, compiles a whole order of magnitude slower than C-style D. Makes me cringe every time I hear "fast code, fast". Our old slogan is a much more accurate description of the current state of things.)


It's not that big of a slow down. Using "fast" you don't import any modules so they never have to be parsed. That's pretty much all of phobos you don't have to parse in that example. That's just the initial cost too. In a big project this won't make a difference. You create a tiny example that is irrelevant to the larger scale, that takes 0.3 seconds longer to compile. It's a magnitude slower cause in your fast example it's literately only parsing 5 lines of code instead of hundreds of lines like it is in your slow example.

Reply via email to