phobos icon indicating copy to clipboard operation
phobos copied to clipboard

Fix slow compilation when using std.regex

Open DmitryOlshansky opened this issue 1 year ago • 4 comments

Taking this short program as an example:

import std.regex, std.stdio;

void main(string[] argv) {
	auto re = regex(argv[1]);
	auto matches = matchFirst(argv[2], re);
	writeln(matches);
}

Before:

time dmd re.d

real	0m2,404s
user	0m2,205s
sys	0m0,200s

After:

time dmd re.d

real	0m1,198s
user	0m1,103s
sys	0m0,096s

I still think the compile time is too big, maybe there is another CTFE-heavy construction hiding in there.

DmitryOlshansky avatar Nov 22 '22 18:11 DmitryOlshansky

Thanks for your pull request, @DmitryOlshansky!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + phobos#8628"

dlang-bot avatar Nov 22 '22 18:11 dlang-bot

@RazvanN7 I don't get cirrus-ci failing on some UDA test in std.traits that shouldn't be affected by my code at all. Any ideas?

DmitryOlshansky avatar Dec 04 '22 11:12 DmitryOlshansky

You should probably rebase to the latest version of phobos, that will most likely fix it.

RazvanN7 avatar Dec 04 '22 12:12 RazvanN7

In general I approve this pr

DmitryOlshansky avatar Apr 15 '23 22:04 DmitryOlshansky