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

Paolo Bonzini paolo.bonzini@lu.unisi.ch
Tue Nov 30 08:51:00 GMT 2004


> Could you please have a look?  I'm not sure what should happen when
> bkref_idx is -1 (i.e. when search_cur_bkref_entry fails to find a bkref
> index) and you are more familiar with this part of the code.

You just don't recurse: the old code used a while loop instead of 
do/while, so it exited before dereferencing ent.

I checked whether specializing the loop for bkref_idx == 1 will give any 
improvement, and it does not.  An alternative possibility which I did 
not try would be to add a dummy bkref_ent but I doubt it is worth.

I thought that this was impossible because the other places crashed 
loudly when search_cur_bkref_entry failed.  While I am slowly 
understanding more of the algorithm, I am still far from being familiar 
with it.  :-(

I include a version of the patch without the indentation changes, and 
the full one.  Tested on the glibc and sed testsuites.

Paolo

2004-11-30  Paolo Bonzini  <bonzini@gnu.org>

	* posix/regexec.c (check_dst_limits_calc_pos_1): Check
	for bkref_idx == -1, and don't recurse in that case.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: regexec-fix-jakub.patch
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20041130/077b2cdb/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: regexec-fix-jakub-b.patch
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20041130/077b2cdb/attachment-0001.ksh>


More information about the Libc-alpha mailing list