Why is std.regex slow, well here is one reason!
Johan
j at j.nl
Thu Feb 23 21:28:17 UTC 2023
On Thursday, 23 February 2023 at 17:06:30 UTC, Richard (Rikki)
Andrew Cattermole wrote:
> As well all know std.regex slows down our builds even if all
> you're doing is importing it.
>
> So on Discord we were chatting and I got annoyed about it
> enough to look into it (which as we all know is a good way to
> make me do something about it).
>
> To start off with lets do some base timings with dmd.
>
> Here is my test module, disable the regex call as required.
>
> ```d
> import std.regex;
>
> void main() {
> auto r = regex(`[a-z]`); // remove me
> }
> ```
>
> To compile this its 2.2s, to compile it without the regex call
> its 1.2s.
Can you try compiling this with LDC's `--ftime-trace`?
On my machine, it takes much shorter than 2.2s, and
`std.uni.unicode.parseSet!(Parser!(string, CodeGen)).parseSet`
(the only big std.uni piece) takes about 1/6th of the total
semantic analysis time (`-o-`).
I'm curious to hear whether `--ftime-trace` would have helped you
for this or not :)
Thanks!
Cheers,
Johan
More information about the Digitalmars-d
mailing list