[limb-svn] r6781 - in template_engines_bench: . php_one_tpl php_one_tpl/templates
svn at limb-project.com
svn at limb-project.com
Fri Feb 8 16:33:23 MSK 2008
Author: korchasa
Date: 2008-02-08 16:33:23 +0300 (Fri, 08 Feb 2008)
New Revision: 6781
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6781
Removed:
template_engines_bench/php_one_tpl/templates/adverts_item.inc
template_engines_bench/php_one_tpl/templates/news_item.inc
template_engines_bench/php_one_tpl/templates/page_news.inc
Modified:
template_engines_bench/index.php
template_engines_bench/php_one_tpl/main.php
template_engines_bench/php_one_tpl/templates/page.inc
Log:
-- add php_one_tpl engine
Modified: template_engines_bench/index.php
===================================================================
--- template_engines_bench/index.php 2008-02-08 12:55:20 UTC (rev 6780)
+++ template_engines_bench/index.php 2008-02-08 13:33:23 UTC (rev 6781)
@@ -1,7 +1,8 @@
<?php
error_reporting(E_ALL);
-define('BENCH_ITERATIONS', 1000);
-define('BENCH_CONCURENCY', 10);
+define('BENCH_ITERATIONS_DEFAULT', 1000);
+define('BENCH_ITERATIONS_MAX', 3000);
+define('BENCH_CONCURENCY', BENCH_ITERATIONS / 200);
define('BENCH_ENGINES_DIR', dirname(__FILE__));
require_once 'bench.inc.php';
define('BENCH_PATH_TO_AB', '/usr/sbin/ab');
@@ -15,6 +16,11 @@
return 'bench_selected';
return 'default';
}
+
+function is_result_action()
+{
+ return ('default' != get_action());
+}
?>
<!-- Powered by LIMB | http://www.limb-project.com/ -->
@@ -226,7 +232,11 @@
<div class="center">
<div id="container">
<div id="page_content"> » <a href="/">Home</a>
+ <?php if(!is_result_action()) { ?>
<h1>Limb template engine benchmark</h1>
+ <?php } else { ?>
+ <h1>Benchmark results</h1>
+ <?php } ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0"
class="border1">
<tr>
@@ -234,23 +244,35 @@
<?php
$action = get_action();
if('bench_all' == $action || 'bench_selected' == $action) {
+
+ echo '<p><a href="'.get_bench_root_url().'">Back to template engines list</a></p>';
+
if('bench_all' == $action)
$engines = get_engines();
else
- $engines = $_REQUEST['engines'];
- echo '<p><a href="'.get_bench_root_url().'">Back to template engines list</a></p>';
+ $engines = $_REQUEST['engines'];
$results = bench_engines($engines);
+
$max_value = max($results);
- echo "<table class=\"table\">";
- echo "<tr><th>name</th><th>rps</th><th>%</th></tr>";
- foreach($results as $name=>$value) {
- echo "<tr><td><a href=\"".get_bench_root_url().$name."/main.php\">$name</a></td><td>$value</td><td>".round($value/$max_value*100)."%</td></tr>";
- }
- echo "</table>";
+
+ ?><table class="table">
+ <tr><th>name</th><th>rps</th><th>%</th></tr>
+ <?php foreach($results as $name=>$value) { ?>
+ <tr>
+ <td><a href="<?=get_bench_root_url().$name?>"/main.php\"><?=name?></a></td>
+ <td><?=$value?></td>
+ <td><?=round($value/$max_value*100)?>%</td>
+ </tr>
+ <?php } ?>
+ </table>
+ <?php
} else {
?>
<form action="" method="post">
+ <label for="iterations">Iterations:</label><input type="text" name="iterations" value="1000" size="4"/>
+ <input type="submit" name="bench_selected" value="Compare selected"/>
<input type="submit" name="bench_all" value="Compare all"/>
+ <hr style="margin:10px 0"/>
<table>
<?php
foreach(get_engines() as $engine) {
@@ -260,11 +282,13 @@
echo '</tr>';
}
?>
- </table>
- <input type="submit" name="bench_selected" value="Compare selected"/>
+ </table>
</form>
<?php }
?>
+
+ <p>You can get benchmark sources:</p>
+ <code><pre>svn co https://svn.limb-project.com/limb/template_engines_bench/</pre></code>
</td>
</tr>
</table>
Modified: template_engines_bench/php_one_tpl/main.php
===================================================================
--- template_engines_bench/php_one_tpl/main.php 2008-02-08 12:55:20 UTC (rev 6780)
+++ template_engines_bench/php_one_tpl/main.php 2008-02-08 13:33:23 UTC (rev 6781)
@@ -1,7 +1,4 @@
<?php
-
include('../data.inc');
-$page = 'news';
-
include('./templates/page.inc');
?>
\ No newline at end of file
Deleted: template_engines_bench/php_one_tpl/templates/adverts_item.inc
===================================================================
--- template_engines_bench/php_one_tpl/templates/adverts_item.inc 2008-02-08 12:55:20 UTC (rev 6780)
+++ template_engines_bench/php_one_tpl/templates/adverts_item.inc 2008-02-08 13:33:23 UTC (rev 6781)
@@ -1,6 +0,0 @@
-<td width=200 valign=top>
-<table bgcolor=#000000 cellspacing=2 cellpadding=2 border=0 width=100%>
-<tr><td><font color=#ffffff><b><?=$idata['section']; ?></b></font></td></tr>
-<tr><td bgcolor=#ffffff><small><a href="<?=$idata['url']; ?>"><?=$idata['title']; ?></a></small>
-</td></tr>
-</table>
\ No newline at end of file
Deleted: template_engines_bench/php_one_tpl/templates/news_item.inc
===================================================================
--- template_engines_bench/php_one_tpl/templates/news_item.inc 2008-02-08 12:55:20 UTC (rev 6780)
+++ template_engines_bench/php_one_tpl/templates/news_item.inc 2008-02-08 13:33:23 UTC (rev 6781)
@@ -1,3 +0,0 @@
-<b><?=$item['time'];?> <?=$item['title'];?></b><br>
-<small><?=$item['short'];?><a href="/news.phtml?id=<?=$item['id'];?>">[ read full story ]</a></small>
-<br>
\ No newline at end of file
Modified: template_engines_bench/php_one_tpl/templates/page.inc
===================================================================
--- template_engines_bench/php_one_tpl/templates/page.inc 2008-02-08 12:55:20 UTC (rev 6780)
+++ template_engines_bench/php_one_tpl/templates/page.inc 2008-02-08 13:33:23 UTC (rev 6781)
@@ -10,7 +10,12 @@
foreach($random_keys as $i) {
$idata = & $_DATA['ADVERTS'][$i];
- include('adverts_item.inc');
+ ?><td width=200 valign=top>
+ <table bgcolor=#000000 cellspacing=2 cellpadding=2 border=0 width=100%>
+ <tr><td><font color=#ffffff><b><?=$idata['section']; ?></b></font></td></tr>
+ <tr><td bgcolor=#ffffff><small><a href="<?=$idata['url']; ?>"><?=$idata['title']; ?></a></small>
+ </td></tr>
+ </table><?php
}
?>
</td>
@@ -70,7 +75,17 @@
</td>
<td width=400 colspan=3>
-<? include('page_'.$page.'.inc'); ?>
+<h2>Introduction</h2>
+<p>Mr. Treehorn draws a lot of water in this town. You don't draw shit, Lebowski. Now we got a nice, quiet little beach community here, and I aim to keep it nice and quiet. So let me make something plain. I don't like you sucking around, bothering our citizens, Lebowski. I don't like your jerk-off name. I don't like your jerk-off face. I don't like your jerk-off behavior, and I don't like you, jerk-off.</p>
+<h2>News</h2>
+<?php
+$n_news = count($_NEWS);
+for($i=0;$i<$n_news;$i++) {
+ $item = $_NEWS[$i];
+ ?><b><?=$item['time'];?> <?=$item['title'];?></b><br>
+ <small><?=$item['short'];?><a href="/news.phtml?id=<?=$item['id'];?>">[ read full story ]</a></small>
+ <br><?php
+} ?>
</td>
</tr>
<tr>
Deleted: template_engines_bench/php_one_tpl/templates/page_news.inc
===================================================================
--- template_engines_bench/php_one_tpl/templates/page_news.inc 2008-02-08 12:55:20 UTC (rev 6780)
+++ template_engines_bench/php_one_tpl/templates/page_news.inc 2008-02-08 13:33:23 UTC (rev 6781)
@@ -1,9 +0,0 @@
-<h2>Introduction</h2>
-<p>Mr. Treehorn draws a lot of water in this town. You don't draw shit, Lebowski. Now we got a nice, quiet little beach community here, and I aim to keep it nice and quiet. So let me make something plain. I don't like you sucking around, bothering our citizens, Lebowski. I don't like your jerk-off name. I don't like your jerk-off face. I don't like your jerk-off behavior, and I don't like you, jerk-off.</p>
-<h2>News</h2>
-<?php
-$n_news = count($_NEWS);
-for($i=0;$i<$n_news;$i++) {
- $item = $_NEWS[$i];
- include('news_item.inc');
-} ?>
\ No newline at end of file
More information about the limb-svn
mailing list