On Fri, Feb 23, 2018 at 08:35:44PM +0000, Rubn via Digitalmars-d wrote:
> 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.

Wrong.  This code was reduced from a bigger module (1600+ lines of code)
containing the offending function.  If I write that function with a
straight loop, the entire module compiles in about 0.4 seconds.  If I
change that function to use Phobos algorithms, the compilation time
slows down to more than 1 second.

> 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.

Please measure before you make statements like that.  You're assuming I
wrote that example out of thin air, but it's actually code reduced from
a larger module where changing a single function more than doubles the
compilation time of the *entire module*.  Parsing is actually extremely
fast, esp. with the DMD front end.  The slowdown is caused by the way
the compiler handles templates (and possibly the way Phobos uses
exponential templates in some places).

And this is only a smaller example of a single module.  I do have code
across multiple modules that take horrendously long to compile because
of heavy template use.


If blunt statements had a point, they wouldn't be blunt...

Reply via email to