More backref performance - no strncmp
James Antill
james@and.org
Thu Oct 31 07:02:00 GMT 2002
"Bonzini" <bonzini@gnu.org> writes:
> I think that using strncmp to match backreferences is incorrect because it
> fails when matching nuls, not to mention inefficient. Also, the return
> value of memcmp and strncmp is quite `complicated' to compute while we only
> need a yes/no answer. For this reason the attached patch replaces strncmp
> with a customized memcmp. Performance improvement is on the order of 5%
> (2.1 s before, 1.98s after on factor.sed).
>
> 2002-10-23 Paolo Bonzini (bonzini@gnu.org)
>
> * posix/regexec.c (my_memcmp): new function.
> Used instead of strncmp throughout the file.
Your my_memcmp() API is different from memcmp() only in the return
value, and given the amount of optimization for the system one I'd be
surprised if your version wasn't slower.
--
# James Antill -- james@and.org
:0:
* ^From: .*james@and\.org
/dev/null
More information about the Libc-alpha
mailing list