[Issue 12394] New: Regression: std.regex unittests take agonizingly long to run - like hours on OSX
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Mar 17 18:45:54 PDT 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12394
Summary: Regression: std.regex unittests take agonizingly long
to run - like hours on OSX
Product: D
Version: D2
Platform: x86
OS/Version: Mac OS X
Status: NEW
Severity: regression
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: bugzilla at digitalmars.com
--- Comment #0 from Walter Bright <bugzilla at digitalmars.com> 2014-03-17 18:45:52 PDT ---
The diff with one that runs in a reasonable length of time is:
----------------------------
3931,3934c3931,3934
< CtContext lookaround()
< {
< CtContext ct;
< ct.total_matches = total_matches;
---
> CtContext lookaround(uint s, uint e)
> {
> CtContext ct;
> ct.total_matches = e - s;
4052c4052
< CtContext context = lookaround(); //split off new context
---
> CtContext context = lookaround(ir[1].raw, ir[2].raw); //split off new context
4187a4188
> auto altCode = testCode.length ? ctSub("else goto case $$;", fixup) : "";
4200,4206c4201,4206
< else
< goto case $$;
< case $$://restore state and go inside loop
< $$
< goto case $$;`, curInfLoop, addr+2, curInfLoop,
< testCode, saveCode(addr+1),
< addr+2, fixup, addr+1, restoreCode(), fixup);
---
> $$
> case $$://restore state and go inside loop
> $$
> goto case $$;`, curInfLoop, addr+2,
> curInfLoop, testCode, saveCode(addr+1),
> addr+2, altCode, addr+1, restoreCode(), fixup);
5209,5216c5209,5215
< matcher.re.ngroup = re.ir[t.pc+2].raw - re.ir[t.pc+1].raw;
< matcher.backrefed = backrefed.empty ? t.matches : backrefed;
< //backMatch
< bool nomatch = (matcher.matchOneShot(t.matches,
IRL!(IR.LookbehindStart))
< == MatchResult.Match) ^ positive;
< freelist = matcher.freelist;
< subCounters[t.pc] = matcher.genCounter;
< if(nomatch)
---
> matcher.re.ngroup = me - ms;
> matcher.backrefed = backrefed.empty ? t.matches : backrefed;
> //backMatch
> auto mRes = matcher.matchOneShot(t.matches.ptr[ms .. me], IRL!(IR.LookbehindStart));
> freelist = matcher.freelist;
> subCounters[t.pc] = matcher.genCounter;
> if((mRes == MatchResult.Match) ^ positive)
5240,5241c5239
< bool nomatch = (matcher.matchOneShot(t.matches,
IRL!(IR.LookaheadStart))
< == MatchResult.Match) ^ positive;
---
> auto mRes = matcher.matchOneShot(t.matches.ptr[ms .. me], IRL!(IR.LookaheadStart));
5246c5244
< if(nomatch)
---
> if((mRes == MatchResult.Match) ^ positive)
5261,5263c5259
< t.pc = re.ir[t.pc].indexOfPair(t.pc);
< uint ms = re.ir[t.pc+1].raw, me = re.ir[t.pc+2].raw;
< finish(t, matches.ptr[ms..me]);
---
> finish(t, matches.ptr[0 .. re.ngroup]);
5653c5649
< assert(c.pre == "@"); // Part of input preceeding match
---
> assert(c.pre == "@"); // Part of input preceding match
7459a7456,7472
> // bugzilla 12076
> unittest
> {
> auto RE = ctRegex!(r"(?<!x\w+)\s(\w+)");
> string s = "one two";
> auto m = match(s, RE);
> }
>
> // bugzilla 12105
> unittest
> {
> auto r = ctRegex!`.*?(?!a)`;
> assert("aaab".matchFirst(r).hit == "aaa");
> auto r2 = ctRegex!`.*(?!a)`;
> assert("aaab".matchFirst(r2).hit == "aaab");
> }
>
------------------------------------------------------
It happens on my OSX machine, possibly because it doesn't have that much memory
and is swapping itself to death. But unittests need to run in a reasonable
amount of time or people won't run them at all.
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list