Benchmark One - High
0.52939612 - 2000 cycles
Benchmark Two - High
0.5329661 - 2000 cycles
Benchmark One - Low
0.58751399000001 - 2000 cycles
Benchmark Two - Low
0.69158023000001 - 2000 cycles
Current Benchmark
<?php
$template = '
<html><head><title>{$title}</title></head><body><?php if(true) { ?>TRUE!<?php } else { ?>FALSE!<?php } ?></body></html>
';
$array = array (
'<?php' => '";',
'?>' => 'echo "',
);
$title = 'Page Title';
eval('echo "'.strtr($template, $array).'";');
?>
vs.
<?php
$template = '
<html><head><title>{$title}</title></head><body><?php if(true) { ?>TRUE!<?php } else { ?>FALSE!<?php } ?></body></html>
';
$array = array (
'<?php' => '";',
'?>' => 'echo "',
);
$title = 'Page Title';
eval('echo "'.strtr($template, $array).'";');
?>
Conclusion
This test shows that this type of benchmarking is technically inaccurate. I have repeated each test multiple times to, hopefully, average
out all the differences.
However, with the low-load tests, (marked as Low), the more times I repeat the test, the more inaccurate the
results become.
With the high-load tests, things are far more accurate, with a 0.02 second margin of error, compared with low-load tests having
a 0.15 second margin of error.
Conclusion results are determined by an average of all results.
For any indecisive (are the same, when taking into account
the margins of accuracy), I will continue the test until a visible difference occurs.
Eventually, I may decide to restart the test if results
appear to be consistantly inconclusive.