List Info

Thread: deep investigation of PHP_Callback




Re: deep investigation of PHP_Callback
user name
2007-05-06 10:55:24
Howdy all...

Bertrand Mansion wrote:
> Le 6 mai 07 à 02:22, Travis Swicegood a écrit :
>>
>> Using this assumption as the base, I put together a
quick script to 
>> generate PHP files to benchmark against (script is
available at  
>> http://plumb.
domain51.com/pear/gen.phps).
>>
>> Using the following ab command I got these
results:
>>
>> ab -c 100 -t 60 http://localhost/path/to/[proc|pear].php > proc|pear.ab
>>
>> proc.php:Requests per second:    165.57 [#/sec]
(mean)
>> pear.php:Requests per second:    111.89 [#/sec]
(mean)
>>
>> Using this as the code to benchmark against,
PHP_Callback (pear) code 
>> is roughly 33% slower, not 320% - 350%.  It is
still a sizable amount 
>> and one to be taken into account when optimizing
code, but given the 
>> other areas where code is almost certainly not
optimized within any 
>> given project, this would probably be one of the
last areas you were 
>> start trying to squeeze the milliseconds out of the
code.
>
> Here are my results for your scripts on a MacBookPro
2.33 Ghz Core Duo:
>
> Proc: Requests per second:    3127.15 [#/sec] (mean)
> Pear: Requests per second:    585.43 [#/sec] (mean)
>
> That's 5 times slower. It is, I think, a lot closer to
truth than your 
> own results...
> For other tests, I am in line with Greg's results.

This borders on moving off-topic, but if you'll indulge
me...

That's actually a really interesting result.  Greg, do you
happen to run 
a Mac as well?  I'm wondering what the difference between
the Mac (maybe 
it's at the BSD level) and Linux is.  I just re-ran the
tests in a much 
more accurate server environment (Intel 4/HT 3.0Ghz with 2Gb
of RAM 
versus my Intel 4 2.0Ghz with .5Gb) and got almost identical
results to 
my first test:

pear.php:Requests per second:    202.67 [#/sec] (mean)
proc.php:Requests per second:    336.94 [#/sec] (mean)

The procedural did start to pull away a bit more, but not by
much.  I 
wonder if it's the dual core architecture or the OSes memory
management.

I've updated the gen.php script to include
memory_get_peak_usage() as 
the last line.  The numbers on that box show 231k vs 300k
for procedural 
versus class.  If you're interested, I'd love to hear the
memory numbers 
on Mac vs. Linux.

-Travis

-- 
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


Re: deep investigation of PHP_Callback
user name
2007-05-06 11:32:17
On May 6, 2007, at 11:55 AM, Travis Swicegood wrote:

>> Here are my results for your scripts on a
MacBookPro 2.33 Ghz Core  
>> Duo:
>>
>> Proc: Requests per second:    3127.15 [#/sec]
(mean)
>> Pear: Requests per second:    585.43 [#/sec]
(mean)
>>
>> That's 5 times slower. It is, I think, a lot closer
to truth than  
>> your own results...
>> For other tests, I am in line with Greg's results.
>
> I'm wondering what the difference between the Mac
(maybe it's at  
> the BSD level) and Linux is.

Travis,

Include is relatively more expensive on a mac because the
system  
calls that PHP makes during the include process are slower
on OS X  
than on linux.  Also, that machine is a laptop with a slow
(but  
quiet) hard drive, although that shouldn't matter because it
should  
be cached after the first request.

Best Regards,

Jeff

-- 
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


[1-10] [11-12]

about | contact  Other archives ( Real Estate discussion Medical topics )