I feel like you're getting a bit personal here, but I'll refrain from doing
the same and simply provide numbers. This is a demonstration to prove purely
the overhead of going into a userspace function that calls an internal
versus calling the internal directly. Obviously this isn't scientific, but
that's not my goal.
3 scripts were created. First called _(""). Second defined a function as
follows:
function b($str) { return gettext($str); }
Third b("") instead of _("") - note the second one was created just to try
and normalize out any deviance from parsing the new function.
Apache Bench was run at 1000 queries to give enough performance to
illustrate a significant deviance. A concurrency of 10 and 100 were used.
Each set was run 3 times and averages were taken to normalize outside
factors. Tests were run randomly at various times throughout the last hour,
to reduce the effect of foreign elements.
First Test (using _)
Concurrency 10: 50.24/50.23/57.43 = 52.63
Concurrency 100: 44.58/46.59/44.53 = 46.23
Second Test (defining b)
Concurrency 10: 55.05/56.19/50.55 = 53.93
Concurrency 100: 45.65/47.06/45.71 = 46.12
Third Test (using b)
Concurrency 10: 55.16/55.82/52.16 = 54.38
Concurrency 100: 46.74/46.39/47.19 = 46.77
I really truly and with all my heart believe that if simply calling a user
created function could drop performance by 25%, PHP would not be a viable
language. Whether my results are accurate findings or not, Rasmus's
demonstration of a 26.3% performance decrease by CALLING A FUNCTION is a lot
to swallow!
Oh, and I'll refrain from making the muse that the latter test was faster.
Having the user make their own function may not be the right solution for
this problem, but its phenomenally silly to argue that it would have a large
performance impact!
Regards,
Cristopher Daniluk
President & CEO
email: cris@dsnet.net
direct: 330/530-2373
Digital Services Network, Inc
Unleashing Your Potential
voice: 800/845-4822
web:
http://www.dsnet.net/
-----Original Message-----
From: Chuck Hagenbuch [mailto:chuck@horde.org]
Sent: Saturday, September 08, 2001 7:23 PM
To: cris@dsnet.net
Cc: 'PHP Developer List'
Subject: RE: [PHP-DEV] Woah
Quoting Cristopher Daniluk <cris@dsnet.net>:
Agreed, but is the speed loss really worth crying about?
Obviously not to you, but I'm pretty sure you came down in the category of
people who'd never used gettext.
It is negligible calling a userspace function versus an internal compared
to
the greater work that the typical PHP script does.
What authority do you have to make this statement? Rasmus posted numbers.
Where
are yours?
-chuck
--
Charles Hagenbuch, <chuck@horde.org>
Some fallen angels have their good reasons.
--
PHP Development Mailing List <
http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
For additional commands, e-mail: php-dev-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net
<Attachment missing>> --
PHP Development Mailing List <
http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
For additional commands, e-mail: php-dev-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net