Skip to content

Commit 10178e5

Browse files
committed
Graphs across stacks are now comparable
1 parent 79c2e76 commit 10178e5

File tree

3 files changed

+76
-16
lines changed

3 files changed

+76
-16
lines changed

index.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,22 @@
3535
}
3636
}
3737

38+
$max_rps = 2300;
39+
$max_memory = 3;
40+
$max_time = 500;
41+
$max_file = 300;
42+
3843
// RPS Benchmark
39-
list($chart_rpm, $div_rpm) = make_graph('rps', 'Throughput', 'requests per second');
44+
list($chart_rpm, $div_rpm) = make_graph('rps', 'Throughput', 'requests per second', $max_rps);
4045

4146
// Memory Benchmark
42-
list($chart_mem, $div_mem) = make_graph('memory', 'Memory', 'peak memory (MB)');
47+
list($chart_mem, $div_mem) = make_graph('memory', 'Memory', 'peak memory (MB)', $max_memory);
4348

4449
// Exec Time Benchmark
45-
list($chart_time, $div_time) = make_graph('time', 'Exec Time', 'ms');
50+
list($chart_time, $div_time) = make_graph('time', 'Exec Time', 'ms', $max_time);
4651

4752
// Included Files
48-
list($chart_file, $div_file) = make_graph('file', 'Included Files', 'count');
53+
list($chart_file, $div_file) = make_graph('file', 'Included Files', 'count', $max_file);
4954
?>
5055
<!DOCTYPE html>
5156
<html lang="en">

libs/make_graph.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
require __DIR__ . '/php-recipe-2nd/make_chart_parts.php';
44

5-
function make_graph($id, $title, $hAxis_title)
5+
function make_graph($id, $title, $hAxis_title, $vAxis_maxValue = 0.01)
66
{
77
global $results;
88

@@ -14,8 +14,8 @@ function make_graph($id, $title, $hAxis_title)
1414
'DarkKhaki', 'DarkMagenta', 'DarkOliveGreen', 'DarkOrange', 'DarkOrchid',
1515
'DarkRed', 'DarkSalmon', 'DarkSeaGreen', 'DarkSlateBlue', 'DarkSlateGray',
1616
);
17-
$graphWidth = 1100;
18-
$graphHeight = 400;
17+
$graphWidth = 1300;
18+
$graphHeight = 500;
1919

2020
$data = array();
2121
$data[] = array('', $id, array('role' => 'style')); // header
@@ -31,7 +31,7 @@ function make_graph($id, $title, $hAxis_title)
3131
'titleTextStyle' => array('fontSize' => 16),
3232
'hAxis' => array('title' => $hAxis_title,
3333
'titleTextStyle' => array('bold' => true)),
34-
'vAxis' => array('minValue' => 0, 'maxValue' => 0.01),
34+
'vAxis' => array('minValue' => 0, 'maxValue' => $vAxis_maxValue),
3535
'width' => $graphWidth,
3636
'height' => $graphHeight,
3737
'bar' => array('groupWidth' => '90%'),

libs/parse_results.php

Lines changed: 63 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,69 @@ function parse_results($file)
3030
'file' => $file,
3131
];
3232
}
33-
34-
foreach ($results as $fw => $data) {
35-
$results[$fw]['rps_relative'] = $data['rps'] / $min_rps;
36-
$results[$fw]['memory_relative'] = $data['memory'] / $min_memory;
37-
$results[$fw]['time_relative'] = $data['time'] / $min_time;
38-
$results[$fw]['file_relative'] = $data['file'] / $min_file;
33+
34+
$frameworks = [
35+
"no-framework",
36+
//"phalcon-1.3",
37+
"phalcon-2.0",
38+
"ice-1.0",
39+
"tipsy-0.10",
40+
"fatfree-3.5",
41+
"slim-2.6",
42+
"ci-3.0",
43+
"nofuss-1.2",
44+
"slim-3.0",
45+
"bear-1.0",
46+
"lumen-5.1",
47+
"ze-1.0",
48+
"radar-1.0-dev",
49+
"yii-2.0",
50+
//"lumen-5.0",
51+
//"silex-1.2",
52+
"silex-1.3",
53+
"cygnite-1.3",
54+
//"fuel-1.8-dev",
55+
"fuel-2.0-dev",
56+
"phpixie-3.2",
57+
//"cake-3.0",
58+
"aura-2.0",
59+
"cake-3.1",
60+
"bear-0.10",
61+
//"symfony-2.5",
62+
//"symfony-2.6",
63+
"symfony-2.7",
64+
//"laravel-4.2",
65+
//"laravel-5.0",
66+
"laravel-5.1",
67+
//"zf-2.4",
68+
"zf-2.5",
69+
//"typo3f-2.3",
70+
"typo3f-3.0",
71+
];
72+
73+
$ordered_results = [];
74+
foreach ($frameworks as $fw) {
75+
if (isset($results[$fw])) {
76+
$data = $results[$fw];
77+
$ordered_results[$fw] = $data;
78+
$results[$fw]['rps_relative'] = $data['rps'] / $min_rps;
79+
$results[$fw]['memory_relative'] = $data['memory'] / $min_memory;
80+
$results[$fw]['time_relative'] = $data['time'] / $min_time;
81+
$results[$fw]['file_relative'] = $data['file'] / $min_file;
82+
} else {
83+
$ordered_results[$fw] = [
84+
'rps' => 0,
85+
'memory' => 0,
86+
'time' => 0,
87+
'file' => 0,
88+
'rps_relative' => 0,
89+
'memory_relative' => 0,
90+
'time_relative' => 0,
91+
'file_relative' => 0,
92+
];
93+
}
3994
}
40-
// var_dump($results);
95+
// var_dump($ordered_results);
4196

42-
return $results;
97+
return $ordered_results;
4398
}

0 commit comments

Comments
 (0)