Why is std.regex slow, well here is one reason!

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Fri Feb 24 13:51:43 UTC 2023


On 24/02/2023 9:26 AM, Walter Bright wrote:
> At minimum, please file a bugzilla issue with your analysis.

https://issues.dlang.org/show_bug.cgi?id=23737

One fix (removal of formattedWrite call) 
https://github.com/dlang/phobos/pull/8698



This function is taking like 700ms! 
https://github.com/dlang/phobos/blob/master/std/regex/internal/ir.d#L52

I don't know how to minimize it, but it does need to be memorized based 
upon std.uni tables. There is getMatcher above it, but yeah wordMatcher 
also needs to pure so that isn't a solution.


More information about the Digitalmars-d mailing list