This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[regex] Speed up somewhat the cases in bug-regex11.c


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

Attachment: 04-optimize-bkref-c#5CB7B.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]