February 24, 2023
https://issues.dlang.org/show_bug.cgi?id=23737

          Issue ID: 23737
           Summary: std.regex is slow to import and use
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody@puremagic.com
          Reporter: alphaglosined@gmail.com

Right now std.regex is quite slow to import and use. Just importing it alone can add a few hundred milliseconds to your build times. This is most likely linked to std.uni and how it handles its tables decompression.

To use a simple regex pattern, adds 1s to your build times, however through some profiling and turning on bootstrap mode in std.uni there are some improvements to be had that will be quite significant.

First is the error method inside of Parser struct, remove formattedWrite.

Second is to stop trying to memorize the CharMatcher in wordMatcher. For some reason, this adds a lot of time that isn't required.

There are more things that can be done, but they don't appear to be big in terms of wins.

--