Bluehost.com Web Hosting $6.95

Re: Benchmark for echoing via comma, concat, inteprolation, andheredoc.

This is a discussion on Re: Benchmark for echoing via comma, concat, inteprolation, andheredoc. within the PHP General forums, part of the PHP Programming Forums category; Robert Cummings wrote: > That echo benchmark though... WTF! Yup similar numbers here tho' not quite as staggering on my ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-27-2008
Colin Guthrie
 
Posts: n/a
Default Re: Benchmark for echoing via comma, concat, inteprolation, andheredoc.

Robert Cummings wrote:
> That echo benchmark though... WTF!


Yup similar numbers here tho' not quite as staggering on my setup:

PHP 5.2.6 with Suhosin-Patch 0.9.6.2 (cli) (built: Aug 25 2008 10:09:21)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies

(Tho' Suhosin is disabled).

To summerise, the echo method took about twice as long as the others.


shell:~> time php -qC test.echo.php >/dev/null
8.52user 8.23system 0:16.97elapsed 98%CPU (0avgtext+0avgdata 0maxresident)k
608inputs+0outputs (2major+2721minor)pagefaults 0swaps

shell:~> time php -qC test.concat.php >/dev/null
7.16user 1.70system 0:08.94elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+2724minor)pagefaults 0swaps

shell:~> time php -qC test.interpol.php >/dev/null
5.84user 1.76system 0:07.62elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+2724minor)pagefaults 0swaps

shell:~> time php -qC test.heredoc.php >/dev/null
5.52user 1.73system 0:07.29elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+2723minor)pagefaults 0swaps

shell:~> time php -qC test.echo.php >/dev/null
8.21user 8.08system 0:16.44elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+2723minor)pagefaults 0swaps

shell:~> time php -qC test.concat.php >/dev/null
7.29user 1.66system 0:08.98elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+2724minor)pagefaults 0swaps

shell:~> time php -qC test.interpol.php >/dev/null
6.34user 1.79system 0:08.15elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+2723minor)pagefaults 0swaps

shell:~> time php -qC test.heredoc.php >/dev/null
6.10user 1.67system 0:07.79elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+2724minor)pagefaults 0swaps



And just for sh1ts and giggles, I tried printf... which although I
expected to be slow, it still turned out faster than the echo!!!


shell:~> time php -qC test.printf.php >/dev/null
11.85user 1.67system 0:13.63elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+2727minor)pagefaults 0swaps

shell:~> time php -qC test.printf.php >/dev/null
12.27user 1.69system 0:13.99elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+2728minor)pagefaults 0swaps


--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
Mandriva Linux Contributor [http://www.mandriva.com/]
PulseAudio Hacker [http://www.pulseaudio.org/]
Trac Hacker [http://trac.edgewall.org/]

Reply With Quote
  #2 (permalink)  
Old 08-27-2008
Robert Cummings
 
Posts: n/a
Default Re: [PHP] Re: Benchmark for echoing via comma, concat,inteprolation, and heredoc.

On Wed, 2008-08-27 at 18:02 +0100, Colin Guthrie wrote:
> Robert Cummings wrote:
> > That echo benchmark though... WTF!

>
> Yup similar numbers here tho' not quite as staggering on my setup:


Hah, your values led me to think about it... then I realized I've been
playing around with Xen lately and was currently running the Xen kernel.
This was having a huge performance penalty on my system... which is odd
since I have a Quad Phenom Black Edition (must be at the kernel level
then since my CPU load is miniscule). Anyways, rebooting to the non Xen
kernel I get the following numbers which reflect the same distribution
but are MUCH faster lol.

shell:~> time php5 -qC test.echo.php > /dev/null

real 0m10.622s
user 0m5.380s
sys 0m4.680s

shell:~> time php5 -qC test.concat.php > /dev/null

real 0m4.875s
user 0m3.990s
sys 0m0.870s

shell:~> time php5 -qC test.interpol.php > /dev/null

real 0m4.799s
user 0m3.740s
sys 0m1.050s

shell:~> time php5 -qC test.heredoc.php > /dev/null

real 0m4.901s
user 0m3.750s
sys 0m1.070s


Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 12:09 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0