[limb-svn] r6399 - 3.x/trunk/limb/macro/tests/bench
svn at limb-project.com
svn at limb-project.com
Tue Oct 9 08:17:57 MSD 2007
Author: pachanga
Date: 2007-10-09 08:17:56 +0400 (Tue, 09 Oct 2007)
New Revision: 6399
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6399
Added:
3.x/trunk/limb/macro/tests/bench/compare.php
Log:
-- adding one more grouped bench
Added: 3.x/trunk/limb/macro/tests/bench/compare.php
===================================================================
--- 3.x/trunk/limb/macro/tests/bench/compare.php (rev 0)
+++ 3.x/trunk/limb/macro/tests/bench/compare.php 2007-10-09 04:17:56 UTC (rev 6399)
@@ -0,0 +1,72 @@
+<?php
+
+set_include_path(dirname(__FILE__) . '/../../../../');
+define('WACT_CACHE_DIR', '/tmp/wact');
+define('WACT_TPLS', dirname(__FILE__) . '/tpl');
+require_once('limb/core/common.inc.php');
+require_once('limb/macro/src/lmbMacroTemplate.class.php');
+require_once('limb/wact/common.inc.php');
+require_once('limb/wact/src/WactTemplate.class.php');
+require_once('limb/wact/src/WactDefaultTemplateConfig.class.php');
+
+for($i=0;$i<1000;$i++)
+ $j = $i;
+
+$name = 'Bob';
+
+$tpl = new lmbMacroTemplate('macro.phtml', new lmbMacroConfig('/tmp/macro', false, false, array(dirname(__FILE__) . '/tpl')));
+$tpl->set('name', $name);
+
+$mark = microtime(true);
+
+$tpl->render();
+
+echo "MACRO 1xrender: " . (microtime(true) - $mark) . "\n";
+
+$mark = microtime(true);
+
+for($i=0;$i<1000;$i++)
+{
+ $tpl->render();
+}
+
+echo "MACRO 1000xrender: " . (microtime(true) - $mark) . "\n";
+
+$tpl = new WactTemplate('wact.html', new WactDefaultTemplateConfig(dirname(__FILE__) . '/settings/wact.ini'));
+$tpl->set('name', $name);
+
+$mark = microtime(true);
+
+$tpl->capture();
+
+echo "WACT 1xrender: " . (microtime(true) - $mark) . "\n";
+
+$mark = microtime(true);
+
+for($i=0;$i<1000;$i++)
+{
+ $tpl->capture();
+}
+
+echo "WACT 1000xrender: " . (microtime(true) - $mark) . "\n";
+
+$mark = microtime(true);
+
+ob_start();
+include(dirname(__FILE__) . '/tpl/native.phtml');
+ob_get_contents();
+ob_end_clean();
+
+echo "PHP 1xrender: " . (microtime(true) - $mark) . "\n";
+
+$mark = microtime(true);
+
+for($i=0;$i<1000;$i++)
+{
+ ob_start();
+ include(dirname(__FILE__) . '/tpl/native.phtml');
+ ob_get_contents();
+ ob_end_clean();
+}
+
+echo "PHP 1000xrender: " . (microtime(true) - $mark) . "\n";
More information about the limb-svn
mailing list