Is there a list of things which are slow to compile?

drathier forum.dlang.org at fi.fo
Thu Jun 4 17:15:58 UTC 2020


On Wednesday, 3 June 2020 at 17:02:35 UTC, H. S. Teoh wrote:
> On Wed, Jun 03, 2020 at 09:36:52AM +0000, drathier via 
> Digitalmars-d-learn wrote:
>> I'm wondering if there's a place that lists things which are 
>> slower/faster to compile? DMD is pretty famed for compiling 
>> quickly, but I'm not seeing particularly high speed at all, 
>> and I want to fix that.
>
> The two usual culprits are:
> - Recursive/chained templates
> - Excessive CTFE
>
> ...
>
> T

Thanks for the comprehensive answer!

I'm not using CTFE at all, because as you thought, Variants 
aren't supported in CTFE. I had to go out of my way to avoid CTFE 
running, since it crashes on Variants. I'm not using UFCS, and 
the long identifiers I was talking about are like 50 characters 
long, from mangling package name + module name + variable name 
together in the source language.

I'm guessing it's mainly templates from my code gen then, and 
there's not much I can do about that; I'm doing code gen from a 
functional language where polymorphism is literally everywhere, 
and so are templates then.

Regarding std.format, std.regex and such, would it be possible to 
put those into their own package or something, so `dub` doesn't 
rebuild them every time? It feels like that'd save a lot of time.


More information about the Digitalmars-d-learn mailing list