diff --git a/README.md b/README.md index 8dc7de5be..4f046d612 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ These are my benchmarks, not yours. **I encourage you to run on your environment |zf-2.4 | 72.88| 1.7| 3.00| 6.0| |typo3-flow-2.3 | 42.61| 1.0| 5.25| 10.5| -Note(1): All the results are run on php with phalcon.so. If you don't load phalcon.so, the rps except for Phalcon probably increase. +Note(1): All the results are run on php with phalcon.so and ice.so. If you don't load phalcon.so or ice.so, the rps except for Phalcon or Ice probably increase. ## How to Benchmark diff --git a/benchmarks/hello_world.sh b/benchmarks/hello_world.sh index 7f929b80c..9586dd542 100644 --- a/benchmarks/hello_world.sh +++ b/benchmarks/hello_world.sh @@ -33,6 +33,10 @@ fw="phalcon-2.0" url="$base/$fw/public/index.php?_url=/hello/index" benchmark "$fw" "$url" +fw="ice-1.0" +url="$base/$fw/public/index.php?_url=/hello/index" +benchmark "$fw" "$url" + fw="slim-2.6" url="$base/$fw/index.php/hello/index" benchmark "$fw" "$url" diff --git a/ice-1.0/App/Bootstrap.php b/ice-1.0/App/Bootstrap.php new file mode 100644 index 000000000..657f6f6b4 --- /dev/null +++ b/ice-1.0/App/Bootstrap.php @@ -0,0 +1,48 @@ +addNamespace(__NAMESPACE__, __DIR__) + ->register(); + +// Create a dependency injector container +$di = new \Ice\Di(); + +// Set some services +$di->request = new \Ice\Http\Request(); +$di->response = new \Ice\Http\Response(); +$di->tag = new \Ice\Tag(); + +$di->set('dispatcher', function () { + $dispatcher = new \Ice\Mvc\Dispatcher(); + $dispatcher->setNamespace(__NAMESPACE__); + + return $dispatcher; +}); + +$di->set('router', function () { + $router = new \Ice\Mvc\Router(); + $router->setRoutes([ + // The default routes + ['GET', '/{controller:[a-z]+}/{action:[a-z]+[/]?}'], + ['GET', '/{controller:[a-z]+[/]?}'], + ['GET', ''], + ]); + + return $router; +}); + +$di->set('view', function () { + $view = new \Ice\Mvc\View(); + $view->setViewsDir(__DIR__ . '/View/'); + + return $view; +}); + +// Create and return a MVC application +return new \Ice\Mvc\App($di); diff --git a/ice-1.0/App/Controller/HelloController.php b/ice-1.0/App/Controller/HelloController.php new file mode 100644 index 000000000..83c2bc481 --- /dev/null +++ b/ice-1.0/App/Controller/HelloController.php @@ -0,0 +1,12 @@ +view->setContent('Hello World!'); + } +} diff --git a/ice-1.0/App/Controller/IndexController.php b/ice-1.0/App/Controller/IndexController.php new file mode 100644 index 000000000..3967e974f --- /dev/null +++ b/ice-1.0/App/Controller/IndexController.php @@ -0,0 +1,14 @@ +getContent() ?> \ No newline at end of file diff --git a/ice-1.0/public/.htaccess b/ice-1.0/public/.htaccess new file mode 100644 index 000000000..2d6a9dbd7 --- /dev/null +++ b/ice-1.0/public/.htaccess @@ -0,0 +1,9 @@ +#/public/.htaccess +Options FollowSymLinks + + RewriteEngine On + + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L] + \ No newline at end of file diff --git a/ice-1.0/public/index.php b/ice-1.0/public/index.php new file mode 100644 index 000000000..8be82f7be --- /dev/null +++ b/ice-1.0/public/index.php @@ -0,0 +1,20 @@ +handle(); +} catch (Exception $e) { + // Dispaly the excepton's message + echo $e->getMessage(); +} + +printf( + "\n%' 8d:%f", + memory_get_peak_usage(true), + microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'] +);