Skip to content

Commit

Permalink
2 minor tweaks to std.regex default engine
Browse files Browse the repository at this point in the history
Roughly 10-15% faster on a few common patterns.
  • Loading branch information
Dmitry Olshansky committed Mar 7, 2016
1 parent 42625ce commit 88c3a3d
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions std/regex/internal/thompson.d
Expand Up @@ -563,14 +563,8 @@ struct ThreadList(DataIndex)
}
static if(withInput)
{
int test = quickTestFwd(pc1, front, re);
if(test >= 0)
{
worklist.insertFront(fork(t, pc2, t.counter));
t.pc = pc1;
}
else
t.pc = pc2;
worklist.insertFront(fork(t, pc2, t.counter));
t.pc = pc1;
}
else
{
Expand Down Expand Up @@ -914,14 +908,13 @@ struct ThreadList(DataIndex)
//dispose list of threads
void recycle(ref ThreadList!DataIndex list)
{
auto t = list.tip;
while(t)
if(list.tip)
{
auto next = t.next;
recycle(t);
t = next;
// just put this head-tail list in front of freelist
list.toe.next = freelist;
freelist = list.tip;
list = list.init;
}
list = list.init;
}

//creates a copy of master thread with given pc
Expand Down

0 comments on commit 88c3a3d

Please sign in to comment.