Anything new about std.regex's compilation times?

H. S. Teoh hsteoh at
Mon Oct 28 19:00:59 UTC 2019

On Mon, Oct 28, 2019 at 06:14:26PM +0000, bachmeier via Digitalmars-d wrote:
> On Monday, 28 October 2019 at 16:23:07 UTC, H. S. Teoh wrote:
> > It's kinda sad because std.regex used to be touted as the fastest
> > regex engine even compared to other regex libraries. But it seems
> > others have caught up since while we've stagnated. :-/
> I like std.regex because it supports arbitrary lookbehind. It's the
> most powerful regex engine I've used, but maybe I live a sheltered
> life.

I like std.regex too!  It's just that it comes at a hefty compile-time
cost. Even non-ctRegex already significantly slows down compilation,
apparently due to heavy template use in its implementation, if you use
ctRegex be prepared for BIG compile time slowdown. Though last I heard,
Dmitry has said that ctRegex is actually slower in practice than regular
regex, so I've pretty much given up on ctRegex and only use "runtime"
regexen now.

AFAICT, the slowdown was caused by the last major revamp of std.regex
(the older version was somewhat faster, compile-time-wise), and I filed
a bug for it, but not much progress has been seen since then.


You have to expect the unexpected. -- RL

More information about the Digitalmars-d mailing list