Miva vs. PHP While Loop Benchmark
<?php
$max = 1000000;
$counter = 0;
$start_time = round(microtime(true) * 1000);
echo round(microtime(true) * 1000).'<br>';
while ($counter < $max) {
$counter++;
}
$difference = round(microtime(true) * 1000) - $start_time;
echo $difference.' miliseconds';
/*
Output:
133 miliseconds
*/
?>
<mvt:if expr="ISNULL g.dev">
<mvt:exit/>
</mvt:if>
<mvt:assign name="g.max" value="1000000" />
<mvt:item name="ry_toolbelt" param="benchmark|mvt_assign|start" />
<mvt:assign name="g.counter" value="1" />
<mvt:while expr="g.counter LT g.max">
<mvt:assign name="g.counter" value="g.counter + 1" />
</mvt:while>
<mvt:item name="ry_toolbelt" param="benchmark|mvt_assign|end" />
<mvt:item name="ry_toolbelt" param="benchmark|mvt_assign|show" />
<!--
Output:
Benchmark mvt_assign: Elapsed Time = 1.207279 sec.
-->
Tested while loops that counted to 1,000,000.
Miva: 1.207279 sec. PHP: 133 miliseconds