On 02/06/2018 01:11 AM, 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?

If the regex string isn't dependent on the template's params, just move the regex outside the template.

Reply via email to