Re: addslashes' speed
| From: | Sascha Schumann | Date: | Sun, 20 Dec 1998 16:53:37 +0000 |
| Subject: | Re: addslashes' speed | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-2913@lists.php.net to get a copy of this message | ||
On Sun, 20 Dec 1998, Zeev Suraski wrote:
> 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.
I said the above with PHP in my mind - much code, many variables. If your
compiler takes the register keyword and tries to optimize there, you will
get a slowdown.
Sorry if this statement sounded to general.
> >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 :)
Time for some improvements ... after 3.0.6 is released.
Regards,
Sascha Schumann |
Consultant | finger sas@schell.de
| for PGP public key
--
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