[regex] Speed up somewhat the cases in bug-regex11.c
Paolo Bonzini
paolo.bonzini@lu.unisi.ch
Wed Nov 3 11:49:00 GMT 2004
The real solution to these bugs would be to save the set of
epsilon-reachable OP_OPEN_SUBEXP and OP_CLOSE_SUBEXP, and store them into
the backreference cache.
But in the meanwhile, this patch can already speed up the problematic
function by a large amount. search_cur_bkref_entry disappears from the
profile, and on a reduced testcase (intermediate between the succeeding and
failing testcases) check_dst_limits_calc_pos is cut to about half the time
it used to take.
This is done by hoisting most checks in check_dst_limits_calc_pos out of the
recursive calls, and by optimizing the loops on the backreference cache
entries. These loops have two exit conditions, end-of-backref-cache and
got-past-this-str_idx: by flagging specially the last backreference cache
entry for each str_idx, we can test the first condition on the first
iteration, and the special flag on every subsequent iteration.
Can you please apply all these patches except the one Bruno remarked on? I
am working out with him a better solution for that.
Paolo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 04-optimize-bkref-c#5CB7B.patch
Type: application/octet-stream
Size: 15295 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20041103/9e81899d/attachment.obj>
More information about the Libc-alpha
mailing list