Browse Source

Working version of the benchmarks

Marco Pivetta 12 years ago
parent
commit
162e6b57ab

+ 3 - 7
php-zend-framework/config/application.config.php

@@ -1,15 +1,11 @@
 <?php
 <?php
 return array(
 return array(
     'modules' => array(
     'modules' => array(
-        'Application',
+        'FrameworkBenchmarks',
     ),
     ),
     'module_listener_options' => array(
     'module_listener_options' => array(
-        'module_paths' => array(
-            './module',
-        ),
-        'config_glob_paths' => array(
-            'config/autoload/{,*.}{global,local}.php',
-        ),
+        'module_paths' => array(),
+        'config_glob_paths' => array(),
         'config_cache_enabled' => true,
         'config_cache_enabled' => true,
         'config_cache_key'     => 'config_cache',
         'config_cache_key'     => 'config_cache',
         'cache_dir'            => 'data/cache',
         'cache_dir'            => 'data/cache',

+ 11 - 2
php-zend-framework/data/cache/.gitignore

@@ -3,6 +3,7 @@
 namespace FrameworkBenchmarks\Controller;
 namespace FrameworkBenchmarks\Controller;
 
 
 use Zend\Mvc\Controller\AbstractActionController;
 use Zend\Mvc\Controller\AbstractActionController;
+use Zend\Stdlib\ArrayUtils;
 use Zend\View\Model\JsonModel;
 use Zend\View\Model\JsonModel;
 use Zend\Db\TableGateway\TableGateway;
 use Zend\Db\TableGateway\TableGateway;
 
 
@@ -32,7 +33,13 @@ class DbController extends AbstractActionController
      */
      */
     public function dbAction()
     public function dbAction()
     {
     {
-        return new JsonModel($this->tableGateway->select(array('id' => mt_rand(1, 10000))));
+        $result = $this->tableGateway->select(array('id' => mt_rand(1, 10000)));
+
+        foreach ($result as $return) {
+            return new JsonModel($return);
+        }
+
+        return $this->notFoundAction();
     }
     }
 
 
     /**
     /**
@@ -46,7 +53,9 @@ class DbController extends AbstractActionController
         $worlds  = array();
         $worlds  = array();
 
 
         for ($i = 0; $i < $queries; $i += 1) {
         for ($i = 0; $i < $queries; $i += 1) {
-            $worlds[] =  $this->tableGateway->select(array('id' => mt_rand(1, 10000)));
+            foreach ($this->tableGateway->select(array('id' => mt_rand(1, 10000))) as $found) {
+                $worlds[] = $found;
+            }
         }
         }
 
 
         return new JsonModel($worlds);
         return new JsonModel($worlds);

+ 3 - 1
php-zend-framework/module/FrameworkBenchmarks/src/FrameworkBenchmarks/Entity/World.php

@@ -2,13 +2,15 @@
 
 
 namespace FrameworkBenchmarks\Entity;
 namespace FrameworkBenchmarks\Entity;
 
 
+use Zend\Stdlib\ArrayObject;
+
 /**
 /**
  * Entity that represents a single entry in the `World` collection of the benchmarks in FrameworkBenchmarks
  * Entity that represents a single entry in the `World` collection of the benchmarks in FrameworkBenchmarks
  *
  *
  * @author Marco Pivetta <[email protected]>
  * @author Marco Pivetta <[email protected]>
  * @link   http://www.techempower.com/benchmarks
  * @link   http://www.techempower.com/benchmarks
  */
  */
-class World
+class World extends ArrayObject
 {
 {
     /**
     /**
      * @var int
      * @var int

+ 5 - 0
php-zend-framework/module/FrameworkBenchmarks/src/FrameworkBenchmarks/Module.php

@@ -68,6 +68,11 @@ class Module
                     'Zend\Db\Adapter\Adapter' => 'Zend\Db\Adapter\AdapterServiceFactory',
                     'Zend\Db\Adapter\Adapter' => 'Zend\Db\Adapter\AdapterServiceFactory',
                 ),
                 ),
             ),
             ),
+            'view_manager' => array(
+                'strategies' => array(
+                    'ViewJsonStrategy',
+                ),
+            ),
         );
         );
     }
     }
 }
 }

+ 1 - 0
php-zend-framework/public/index.php

@@ -1,4 +1,5 @@
 <?php
 <?php
+ini_set('display_errors', 1);
 chdir(dirname(__DIR__));
 chdir(dirname(__DIR__));
 
 
 require __DIR__ . '/../vendor/autoload.php';
 require __DIR__ . '/../vendor/autoload.php';