<?
////////////////////////////////////////////////////////////////
// QTemplate example :: 99x99 matrix ( perfomance test )
// Produces 9901 call of _warp() function
// (c) Gregory A. Rozanoff, 2003
////////////////////////////////////////////////////////////////
include "class.template.inc";
function getmicrotime() {
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
$start = getmicrotime();
$tpl = new template("templates.tpl");
$tpl->assign("title", "QTemplate test script :: 100x100 matrix");
for ($j = 1; $j < 100; $j++) {
$tpl->reset("entry");
for ($i = 1; $i < 100; $i++) {
$tpl->assign("value", $i * $j);
$tpl->assign("color", $i == $j ? "ffff00" : "999999");
$tpl->assign("font_color", $i == $j ? "000000" : "ffffff");
$tpl->assign(".entry");
}
$tpl->assign("index", $j);
$tpl->assign(".row");
}
$tpl->assign("main");
echo $tpl->out("main");
$stop = getmicrotime();
$uptime = round(($stop - $start) * 1000000) / 1000;
echo "\n<!-- Execution time : ".$uptime." mc -->";
?>
|