Browse Source

Merge branch 'master' of github.com:TechEmpower/FrameworkBenchmarks

Mike Smith 11 years ago
parent
commit
27449a975b
6 changed files with 47 additions and 27 deletions
  1. 5 2
      hhvm/db.php
  2. 5 2
      hhvm/fortunes.php
  3. 7 3
      hhvm/json.php
  4. 6 2
      hhvm/plaintext.php
  5. 12 9
      hhvm/queries.php
  6. 12 9
      hhvm/updates.php

+ 5 - 2
hhvm/db.php

@@ -5,5 +5,8 @@
 
 require_once dirname(__FILE__).'/once.php.inc';
 
-$b = new Benchmark();
-$b->bench_db();
+function main() {
+  $b = new Benchmark();
+  $b->bench_db();
+}
+main();

+ 5 - 2
hhvm/fortunes.php

@@ -5,5 +5,8 @@
 
 require_once dirname(__FILE__).'/once.php.inc';
 
-$b = new Benchmark();
-$b->bench_fortunes();
+function main() {
+  $b = new Benchmark();
+  $b->bench_fortunes();
+}
+main();

+ 7 - 3
hhvm/json.php

@@ -2,6 +2,10 @@
 //
 // 1. JSON Test
 //
-$data = json_encode(array('message' => 'Hello, World!'));
-header('Content-Type: application/json');
-echo $data;
+
+function main() {
+  $data = json_encode(array('message' => 'Hello, World!'));
+  header('Content-Type: application/json');
+  echo $data;
+}
+main();

+ 6 - 2
hhvm/plaintext.php

@@ -2,5 +2,9 @@
 //
 // 6. Plaintext Test
 //
-header('Content-Type: text/plain; charset=utf-8');
-echo 'Hello, World!';
+
+function main() {
+  header('Content-Type: text/plain; charset=utf-8');
+  echo 'Hello, World!';
+}
+main();

+ 12 - 9
hhvm/queries.php

@@ -5,14 +5,17 @@
 
 require_once dirname(__FILE__).'/once.php.inc';
 
-// Read number of queries to run from URL parameter
-$query_count = 1;
-if (!empty($_GET['queries'])) {
-  $query_count = intval($_GET['queries']);
-}
+function main() {
+  // Read number of queries to run from URL parameter
+  $query_count = 1;
+  if (!empty($_GET['queries'])) {
+    $query_count = intval($_GET['queries']);
+  }
 
-// Fix the queries limits
-$query_count = $query_count < 1 ? 1 : ($query_count > 500 ? 500 : $query_count);
+  // Fix the queries limits
+  $query_count = $query_count < 1 ? 1 : ($query_count > 500 ? 500 : $query_count);
 
-$b = new Benchmark();
-$b->bench_queries($query_count);
+  $b = new Benchmark();
+  $b->bench_queries($query_count);
+}
+main();

+ 12 - 9
hhvm/updates.php

@@ -5,14 +5,17 @@
 
 require_once dirname(__FILE__).'/once.php.inc';
 
-// Read number of queries to run from URL parameter
-$query_count = 1;
-if (!empty($_GET['queries'])) {
-  $query_count = intval($_GET['queries']);
-}
+function main() {
+  // Read number of queries to run from URL parameter
+  $query_count = 1;
+  if (!empty($_GET['queries'])) {
+    $query_count = intval($_GET['queries']);
+  }
 
-// Fix the queries limits
-$query_count = $query_count < 1 ? 1 : ($query_count > 500 ? 500 : $query_count);
+  // Fix the queries limits
+  $query_count = $query_count < 1 ? 1 : ($query_count > 500 ? 500 : $query_count);
 
-$b = new Benchmark();
-$b->bench_updates($query_count);
+  $b = new Benchmark();
+  $b->bench_updates($query_count);
+}
+main();