Re: addslashes' speed
| From: | Zeev Suraski | Date: | Sun, 20 Dec 1998 18:27:25 +0000 |
| Subject: | Re: addslashes' speed | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-2912@lists.php.net to get a copy of this message | ||
At 04:27 20/12/98 +0100, Sascha Schumann wrote:
>Hi,
>
>the attached patch speeds up addslashes about 30% (benchmarked on 34MB
>/dev/random data, pgcc 1.1 with -O6 -mcpu=pentium).
>
>Btw, using register in a user level program is non sense :-) The effect is
>rather drastical on a platform with few available registers resulting in
>nothing but a slowdown.
That's not true. 'register' is a compiler hint telling the compiler that
this variable is going to be intensively used, and if the code is small
enough, the compiler should try mapping it to a register. Some compilers
(noteably, Visual C++) completely ignore this hint, others take it for what
it is, a hint. I would really hope there's no compiler out there that
'takes your word for it' and maps it to a register no matter what. As a
matter of fact, I'm pretty sure there's no such compiler.
>Anyone objects against a commit?
Other than the part where you remove the register hint, this looks like a
good optimization. It was pretty dumb on my side to effectively calculate
that length twice :)
Zeev
--
Zeev Suraski <zeev@zend.com>
For a PGP public key, finger bourbon@netvision.net.il
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net