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 0swapsAnd 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/]
Attachment:
test.printf.php
Description: application/php
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php