I would assume it does, since parsing each instruction and calling the
internal functions to execute each echo should take time. I would use
heredoc, which would allow you to make a single call and still keep the
formatting of the string.
You might also be interested in my own plugin to the Php Compiler which does
just that, it compacts consecutive echos:
http://satyam.com.ar/pht/compacting_echos.htm. This is a pre-compiler, it
produces a new PHP source which will be the one interpreted. This new
source is not quite legible as you wish, but it is not meant to be, all the
nice formatting for the echo is lost, but it is not a source to be
mantained, you would still use the originals to edit, the output of the
pre-compiler to execute. So, you would be able to format the echoes in the
source in whichever way you wish, the pre-compiler plugin would take care of
compacting them for speed.
Notice that the pre-compiler itself can use my plugin or any other anybody
might develop and I would encourage people in this list to do so. The
plugin to compact echos was a consequence of the plugin I meant to do, which
you will find at http://satyam.com.ar/pht/, which produced a large number of
echos and so it almost forced me to do something about them. I never
thought about other possible compile-time optimizations, but if anyone does,
the Php Compiler is a wonderful platform to do them.
I am sure you will also get a lot of replies sugesting template engines such
as Smarty.
Satyam
----- Original Message -----
From: "Jean-Christophe Roux" <jcxxr@xxxxxxxxx>
To: <php-general@xxxxxxxxxxxxx>
Sent: Saturday, December 23, 2006 7:33 PM
Subject: Script's length, echo, and execution speed
Hello,
I have this php script of 3,500 lines with a big switch that is such that on
each pass maybe 300 lines of codes are executed at most. The current speed
of the file is ok. I like to keep the file like that because at each pass
there is a check on the whole script and it fails if there is a typo
somewhere. Also, I like to have one file instead of many files. But I am
wondering if speed is not severaly hurt. What are the general guidelines in
terms
of length of script?
Also, I am writing things like that:
echo '<table>';
echo '<tr>';
echo "<td>Content</td>";
echo '</tr>';
echo '</table>';
I like it this way because the script is visually very well aligned, with
one action
per line and that makes things easier for me to read and understand. But, so
many echoes may be considered bad practice; maybe it impacts speed
significantly.
Thanks
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php