You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$template_tested = $db->get_list( "SELECT template_engine FROM template_benchmark WHERE test='$test' GROUP BY template_engine ORDER BY template_engine", "template_engine", "template_engine" );
13
-
14
-
if( $template_selected = get( 'template' ) ){
15
-
$where = "WHERE test='$test' AND (";
16
-
$i=0;
17
-
foreach( $template_selectedas$tpl => $on ){
18
-
$where .= $i==0?" template_engine='$tpl'":" OR template_engine='$tpl'";
$rows = $db->get_list( "SELECT template_engine, n, avg(execution_time) AS execution_time, round(avg(memory)/1024) AS memory FROM template_benchmark $where GROUP BY template_engine, n ORDER BY n, template_engine" );
27
-
$template_show = $db->get_list( "SELECT template_engine, avg(execution_time) AS execution_time FROM template_benchmark $where GROUP BY template_engine ORDER BY n, template_engine", "template_engine", "template_engine" );
28
-
$nrows = $db->get_list( "SELECT n FROM template_benchmark $where GROUP BY n" );
$summary = $db->get_list( "SELECT template_engine AS name, avg(execution_time) AS execution_time, avg(memory) AS memory FROM template_benchmark WHERE test='$test' GROUP BY template_engine ORDER BY template_engine" );
11
+
$summary = DB::getAllArray( "SELECT template_engine AS name,
12
+
avg(execution_time) AS execution_time,
13
+
avg(memory) AS memory
14
+
FROM template_benchmark
15
+
WHERE test=:test
16
+
GROUP BY template_engine
17
+
ORDER BY template_engine",
18
+
array(':test'=>$test)
19
+
);
12
20
13
-
$template_tested = $db->get_list( "SELECT template_engine FROM template_benchmark WHERE test='$test' GROUP BY template_engine ORDER BY template_engine", "template_engine", "template_engine" );
$where .= $i==0?" template_engine='$tpl'":" OR template_engine='$tpl'";
20
-
$i=1;
21
-
}
22
-
$where .= ")";
23
-
}
24
-
else
25
-
$where = "WHERE test='$test'";
26
-
27
-
$rows = $db->get_list( "SELECT template_engine, n, avg(execution_time) AS execution_time, avg(memory) AS memory FROM template_benchmark $where GROUP BY template_engine, n ORDER BY n, template_engine" );
28
-
$template_show = $db->get_list( "SELECT template_engine, avg(execution_time) AS execution_time FROM template_benchmark $where GROUP BY template_engine ORDER BY n, template_engine", "template_engine", "template_engine" );
29
-
$nrows = $db->get_list( "SELECT n FROM template_benchmark $where GROUP BY n" );
Copy file name to clipboardExpand all lines: index.php
+54-27Lines changed: 54 additions & 27 deletions
Original file line number
Diff line number
Diff line change
@@ -7,50 +7,76 @@
7
7
* Distributed under MIT license http://www.opensource.org/licenses/mit-license.php
8
8
*/
9
9
10
-
11
10
session_start();
11
+
require"vendor/autoload.php";
12
12
13
13
if(isset($_SESSION['working'])) {
14
14
header("Refresh: 30; url=index.php");
15
15
echo'Benchmarking currently in progress. The results will appear here once the test has completed.' . "\n";
16
16
exit();
17
17
}
18
18
19
-
require_once"library/mysql.class.php";
20
19
require_once"library/functions.php";
21
20
require_once"library/config.php";
22
21
23
-
$db = newmysql;
24
-
$db->connect() ordie("db connection error");
22
+
useRain\DB;
23
+
24
+
DB::init();
25
25
26
26
$test = get('test')=='loop'?'loop':'assign';
27
27
28
-
$summary = $db->get_list( "SELECT template_engine AS name, avg(execution_time) AS execution_time, avg(memory) AS memory FROM template_benchmark WHERE test='$test' GROUP BY template_engine ORDER BY execution_time" );
29
-
30
-
$last_update = $db->get_field( "time", "SELECT time FROM template_test_counter LIMIT 1" );
28
+
$summary = DB::getAll("SELECT template_engine AS name,
29
+
avg(execution_time) AS execution_time,
30
+
avg(memory) AS memory
31
+
FROM template_benchmark
32
+
WHERE test=:test
33
+
GROUP BY template_engine
34
+
ORDER BY execution_time",
35
+
array(":test"=>$test)
36
+
);
37
+
38
+
$last_update = DB::getField("SELECT time
39
+
FROM template_test_counter
40
+
LIMIT 1");
31
41
$last_update_date = date( "M d Y", $last_update );
$template_tested = (array) $db->get_list( "SELECT template_engine FROM template_benchmark WHERE test='$test' GROUP BY template_engine ORDER BY template_engine", "template_engine", "template_engine" );
37
-
38
-
if( $template_selected = get( 'template' ) ){
39
-
$where = "WHERE test='$test' AND (";
40
-
$i=0;
41
-
foreach( $template_selectedas$tpl => $on ){
42
-
$where .= $i==0?" template_engine='$tpl'":" OR template_engine='$tpl'";
43
-
$i=1;
44
-
}
45
-
$where .= ")";
46
-
}
47
-
else
48
-
$where = "WHERE test='$test'";
49
-
50
-
51
-
$rows = $db->get_list( "SELECT template_engine, n, avg(execution_time) AS execution_time, avg(memory) AS memory FROM template_benchmark $where GROUP BY template_engine, n ORDER BY n, execution_time, template_engine" );
52
-
$template_show = $db->get_list( "SELECT template_engine, avg(execution_time) AS execution_time FROM template_benchmark $where GROUP BY template_engine ORDER BY n, execution_time, template_engine", "template_engine", "template_engine" );
53
-
$nrows = $db->get_list( "SELECT n FROM template_benchmark $where GROUP BY n" );
0 commit comments