note 28843 added to function.echo
| From: | "zombie\)at" at rack1 dot php dot net | Date: | Sat, 25 Jan 2003 17:26:28 +0000 |
| Subject: | note 28843 added to function.echo | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-42737@lists.php.net to get a copy of this message | ||
Echo is an i/o process and i/o processes are typically time consuming. For the longest time i have
been outputting content by echoing as i get the data to output. Therefore i might have hundreds of
echoes in my document. Recently, i have switched to concatenating all my string output together and
then just doing one echo at the end. This organizes the code more, and i do believe cuts down on a
bit of time. Likewise, i benchmark all my pages and echo seems to influence this as well. At the top
of the page i get the micro time, and at the end i figure out how long the page took to process.
With the old method of "echo as you go" the processing time seemed to be dependent on the
user's net connection as well as the servers processing speed. This was probably due to how
echo works and the sending of packets of info back and forth to the user. One an one script i was
getting .0004 secs on a cable modem, and a friend of mine in on dialup was getting .2 secs. Finally,
to test that echo is slow; I built strings of XML and XSLT and used the PHP sablotron functions to
do a transformation and return a new string. I then echoed the string. Before the echo, the process
time was around .025 seconds and .4 after the echo. So if you are big into getting the actual
processing time of your scripts, don't include echoes since they seem to be user dependent.
Note that this is just my experience and it could be a fluke.
--
http://www.php.net/manual/en/function.echo.php
http://master.php.net/manage/user-notes.php?action=edit+28843
http://master.php.net/manage/user-notes.php?action=delete+28843
http://master.php.net/manage/user-notes.php?action=reject+28843