Timing test of the parser... Makes no difference
| From: | Daevid Vincent | Date: | Sat, 05 Apr 2003 23:59:15 +0000 |
| Subject: | Timing test of the parser... Makes no difference | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-142549@lists.php.net to get a copy of this message | ||
It seems that it makes almost no difference if you switch in and out of
the parser or stay within it...
Does this seem like a fair test? Having said that, I would suggest
always using the first method as it's much cleaner to read and color
coding works in most editors.
-- output ---
version one: 0.098537087440491 seconds
version two: 0.096035003662109 seconds
--- test ---
<?php
function getmicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
$ITERATIONS = 10000;
$time_start = getmicrotime();
for ($i = 1; $i < $ITERATIONS; $i++)
{
?>
blah <?=$i?>
<?php
}
$time_end = getmicrotime();
$time1 = $time_end - $time_start;
$time_start = getmicrotime();
$tf = TRUE;
for ($i = 1; $i < $ITERATIONS; $i++)
{
echo "blah ".$i."\n";
}
$time_end = getmicrotime();
$time2 = $time_end - $time_start;
echo "<P>version one: \t$time1 seconds<P>\n";
echo "version two: \t$time2 seconds<P>\n";
?>