diff options
Diffstat (limited to 'src/Benchmarks/bigtable/php.php')
-rw-r--r-- | src/Benchmarks/bigtable/php.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/Benchmarks/bigtable/php.php b/src/Benchmarks/bigtable/php.php new file mode 100644 index 0000000..f2e51a4 --- /dev/null +++ b/src/Benchmarks/bigtable/php.php | |||
@@ -0,0 +1,30 @@ | |||
1 | <?php | ||
2 | $table = array_fill(0, 1000, array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)); | ||
3 | |||
4 | function test_bigtable($table) { | ||
5 | ob_start(); | ||
6 | ?> | ||
7 | <table> | ||
8 | <?php foreach($table as $row) { ?> | ||
9 | <tr> | ||
10 | <?php foreach($row as $value) { ?> | ||
11 | <td><?php echo $value; ?></td> | ||
12 | <?php } ?> | ||
13 | </tr> | ||
14 | <?php } ?> | ||
15 | </table> | ||
16 | <?php | ||
17 | return ob_get_clean(); | ||
18 | } | ||
19 | |||
20 | $request_count = 1000; | ||
21 | |||
22 | $start = microtime(true); | ||
23 | for ($i = 0; $i < $request_count; $i++) | ||
24 | { | ||
25 | test_bigtable($table); | ||
26 | } | ||
27 | $elapsed = microtime(true) - $start; | ||
28 | $time_per_request = ($elapsed / $request_count) * 1000; | ||
29 | echo "\"PHP\", $time_per_request\n"; | ||
30 | ?> | ||