I have been benchmarking the various components i write in php. this is to ensure that they dont super slowdown peoples built times.
i thought you might want to use the code i used, to benchmark and speed up your own sites. Its php.
Put this FIRST BEFORE ANY OTHER TEXT, in a primary template:
Put this JUST BEFORE </body>
Now, at the footer of every page, the time it took for actinic to generate that page, is displayed, in seconds/ms.
A file will be generated on first run. everytime you preview a page, its render time and filename will be logged.
it is located at 'C:\actBenchmark.txt'
I had these blocks surrounded by simple 'DebugPageSpeed' variables, that was set to 'true' when i want to debug and 'false' when i wasnt debugging.
have fun.
i thought you might want to use the code i used, to benchmark and speed up your own sites. Its php.
Put this FIRST BEFORE ANY OTHER TEXT, in a primary template:
Code:
<actinic:block php="true" >
$starttime = microtime();
$startarray = explode(" ", $starttime);
$starttime = $startarray[1] + $startarray[0];
</actinic:block>
Code:
<actinic:block php="true" >
$endtime = microtime();
$endarray = explode(" ", $endtime);
$endtime = $endarray[1] + $endarray[0];
$totaltime = $endtime - $starttime;
$totaltime = round($totaltime,5);
echo "This page loaded in $totaltime seconds.";
$myFile = "C:\\actBenchmark.txt";
$fh = fopen($myFile, 'a') or die("can't open file");
$stringData = $totaltime."\t<actinic:variable name="SectionURL" selectable="false" />\n";
fwrite($fh, $stringData);
fclose($fh);
</actinic:block>
A file will be generated on first run. everytime you preview a page, its render time and filename will be logged.
it is located at 'C:\actBenchmark.txt'
I had these blocks surrounded by simple 'DebugPageSpeed' variables, that was set to 'true' when i want to debug and 'false' when i wasnt debugging.
have fun.


Comment