This is the mail archive of the cygwin-developers mailing list for the Cygwin 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]

Re: rawmemchr


On Tue, May 20, 2008 at 08:19:33PM -0600, Eric Blake wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I noticed that the cygwin source code frequently uses strchr(p,0) to find
> the trailing NUL of a string.  glibc documents that they special case this
> condition to be noticeably faster than normal strchr, and a couple
> instructions faster than the corresponding strlen(p)+p; however, the
> current newlib implementation lacks this special case, and is somewhat
> inefficient when compared to glibc's extension of rawmemchr(p,0).  Put
> another way, the current newlib implementation of strchr performs two
> checks for a NUL byte instead of one, making strchr almost twice as slow
> as strlen at finding the ending NUL.

Unless there's something I'm missing, cygwin should be using the assembly
language routines in string.h.

cgf


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