Bye bye, fast compilation times

Dmitry Olshansky dmitry.olsh at gmail.com
Tue Feb 6 06:11:55 UTC 2018


On Tuesday, 6 February 2018 at 05:45:35 UTC, Steven Schveighoffer 
wrote:
> On 2/6/18 12:35 AM, Dmitry Olshansky wrote:
>> 
>> That’s really bad idea - isEmail is template so the burden of 
>> freaking slow ctRegex
>> is paid on per instantiation basis. Could be horrible with 
>> separate compilation.
>
> Obviously it is horrible. On my mac, it took about 2.5 seconds 
> to compile this one line.
>
> I'm not sure how to fix it though... I suppose you could make

Just use the run-time version, it’s not that much slower. But 
then again static ipRegex = regex(...) will parse and build regex 
at CTFE.

Maybe lazy init?

> it 3 overloads, but this defeats a lot of the purpose of having 
> templates in the first place.
>
> -Steve




More information about the Digitalmars-d mailing list