Re: [PHP-DEV] addslashes' speed From: Zeev Suraski (zeev <email protected>)
Date: 12/20/98

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 <email protected>>
For a PGP public key, finger bourbon <email protected>

-- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe <email protected> For help: php-dev-help <email protected>