Beispiel #1
0
$forcecompile = false;
if (isset($argv[2])) {
    $forcecompile = (bool) $argv[2];
}
$forcescan = false;
if (isset($argv[3])) {
    $forcescan = (bool) $argv[3];
}
set_include_path(dirname(__FILE__) . '/../../../../');
require_once 'limb/core/common.inc.php';
require_once 'limb/core/src/lmbSet.class.php';
require_once 'limb/macro/src/lmbMacroTemplate.class.php';
require_once dirname(__FILE__) . '/profile.inc.php';
$tpl = new lmbMacroTemplate($file, array('cache_dir' => '/tmp/macro', 'forcecompile' => $forcecompile, 'forcescan' => $forcescan, 'tpl_scan_dirs' => array(dirname(__FILE__))));
/*$tpl = new lmbMacroTemplate($file, new lmbSet(array('cache_dir' => '/tmp/macro', 
  'forcecompile' => $forcecompile, 
  'forcescan' => $forcescan, 
  'tpl_scan_dirs' => array(dirname(__FILE__)))));*/
for ($i = 2; $i < $argc; $i++) {
    if (strpos($argv[$i], '=') === false) {
        continue;
    }
    list($key, $value) = explode('=', $argv[$i]);
    $tpl->set($key, $value);
}
profile_start();
for ($i = 0; $i < 1000; $i++) {
    $tpl->render();
}
profile_end("running {$i} iterations of render");
/**
 * Stop current profiling session and dump split time table.
 *
 * @return \Components\Debug_Profiler
 *
 * @throws \Components\Runtime_Exception If no profiling session is started.
 */
function profile_end_dump()
{
    $profiler = profile_end();
    $entries = [];
    $total = 0;
    foreach ($profiler->splitTimeTable() as $entry) {
        $entries[] = sprintf('%s: %.5fs', $entry[1], $entry[0]);
        $total += $entry[0];
    }
    $entries[] = sprintf('TOTAL: %.5fs', $total);
    dump($entries);
    return $profiler;
}
Beispiel #3
0
<?php

require_once dirname(__FILE__) . '/profile.inc.php';
$name = 'Bob';
profile_start();
for ($i = 0; $i < 1000; $i++) {
    ob_start();
    include dirname(__FILE__) . '/tpl/native.phtml';
    $content = ob_get_contents();
    ob_end_clean();
}
profile_end("running {$i} iterations of include");
Beispiel #4
0
<?php

if (!isset($argv[1])) {
    die("\nTemplate argument is required\n");
}
$file = $argv[1];
set_include_path(dirname(__FILE__) . '/../../../../');
define('WACT_CACHE_DIR', '/tmp/wact');
define('WACT_TPLS', dirname(__FILE__));
require_once 'limb/wact/common.inc.php';
require_once 'limb/wact/src/WactTemplate.class.php';
require_once 'limb/wact/src/WactDefaultTemplateConfig.class.php';
require_once dirname(__FILE__) . '/profile.inc.php';
$tpl = new WactTemplate($file, new WactDefaultTemplateConfig(dirname(__FILE__) . '/settings/wact.ini'));
for ($i = 2; $i < $argc; $i++) {
    list($key, $value) = explode('=', $argv[$i]);
    $tpl->set($key, $value);
}
profile_start();
for ($i = 0; $i < 1000; $i++) {
    $tpl->capture();
}
profile_end("running {$i} iterations of capture");