On 2/23/18 3:15 PM, 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.)
Thanks for a solid bug report. The right response here is to live into
our "fast code, fast" principle. It might be the case that the slowdown
is actually the negative side of an acceleration :o) - before Dmitry's
recent work, the sheer act of importing std.regex would be slow. Dmitry,
do you think you could use some precompiled tables to mitigate this? Is
your caching compiler going to help the matter?