Bye bye, fast compilation times

Nathan S. no.public.email at example.com
Tue Feb 6 13:51:01 UTC 2018


On Tuesday, 6 February 2018 at 06:11:55 UTC, Dmitry Olshansky 
wrote:
> 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?

FYI I've made a pull request that replaces uses of regexes in 
std.net.isemail. It turns out they weren't being used for 
anything indispensable. Import benchmark results were encouraging.

https://github.com/dlang/phobos/pull/6129


More information about the Digitalmars-d mailing list