On Saturday, 24 February 2018 at 00:21:06 UTC, Andrei
Alexandrescu wrote:
On 2/23/18 3:15 PM, H. S. Teoh wrote:
tl;dr: A trivial piece of code, written as ostensibly
"idiomatic D" with. 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.)
cc Dmitry
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?
First things first sombody need to profile compiler while
compiling this snippet.
My guesswork is that instantiating templates + generating long
symbols is the problem.
The template system obviously needs some (re)work, I think at a
time nobody thought templates would be that abundant in D code.
Nowdays it’s easily more templates then normal functions.
Is your caching compiler going to help the matter?
In some distant bright future where it may be finally applied to
instantiating templates and caching codegen but even then I’m not
100% positive.
Finally, I repeat - we have not yet identified problem. What
takes time in the compiler needs to be figured out by disecting
the time taken via profiler and experimentation.
—
Dmitry Olshansky