Re: [PHP4BETA] cvs: php4 /ext/session/ session.c

From: Date: Mon, 15 May 2000 15:55:16 +0000
Subject: Re: [PHP4BETA] cvs: php4 /ext/session/ session.c
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-15056@lists.php.net to get a copy of this message
strchr() should be the exception to the rule where mem_* functions are faster than str_*. If you check out the logic in glibc you'll see that the implementation is more complex because strchr() just checks for null and memchr() has a counter to maintain. It seems weird to me that you got the results you got. I looked at the glibc-2.1 source code and strchr() looked to be clearly faster than memchr(). Maybe they wrote a native assembly version of memchr()? You might be right but try and benchmark the C source code of both functions included in glibc on 2-3 platforms. Andi On Mon, 15 May 2000, Sascha Schumann wrote: > On Mon, 15 May 2000, Andi Gutmans wrote: > > > strchr is faster than memchr. > > That means nothing without counterprove. > > `memchr' is simpler, thus it is usually implemented in a faster > way than `strchr'. > > For example, on Linux/x86 memchr is clearly faster: > > $ time ./x > > real 0m5.717s > user 0m5.710s > sys 0m0.000s > $ time ./x 1 > > real 0m8.179s > user 0m8.080s > sys 0m0.000s > > Sample program attached. > > - Sascha >

« previous php.version4 (#15056) next »