"marginally" definitely means "marginally" in this case.
We're talking thousands of variable replacements (double quoted) before you'll notice ANY performace decrease, but you are correct, you do get some miniscule amount of gain from breaking out of quotes to substitute.
for 100,000 iterations, I'm getting (~):PHP Code:<?php
function microtimeAsDouble()
{
$nowTime = explode(" ", microtime());
return ($nowTime[0] + $nowTime[1]);
}
// turn on automatic flushing:
ob_implicit_flush();
// seed random number generator:
srand((double)microtime()*10000);
// set memory limit to 64 megs.
ini_set('memory_limit', '64M');
// how many?
$iterations = 10000;
$b = "test";
$startTime = microtimeAsDouble();
for ($i=0; $i<=$iterations; $i++) {
$a = '---'. $b .'---';
}
$singleTime = microtimeAsDouble() - $startTime;
echo "Single: ". $singleTime ." seconds.<br /><hr />";
$startTime = microtimeAsDouble();
for ($i=0; $i<=$iterations; $i++) {
$a = "---$b---";
}
$doubleTime = microtimeAsDouble() - $startTime;
echo "Double: ". $doubleTime ." seconds.<br /><hr />";
?>
SCode:Single: 0.38587403297424 seconds. Double: 0.50207698345184 seconds.




Bookmarks