From eb2d4fbd92160561bebbb11eac8cc4b731ccb5b6 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Sun, 26 May 2013 17:53:51 -0400 Subject: [PATCH] Added benchmark application. --- apps/benchmark/LICENSE.md | 32 +++++++++++++ apps/benchmark/README.md | 56 ++++++++++++++++++++++ apps/benchmark/composer.json | 20 ++++++++ apps/benchmark/index.php | 18 +++++++ .../protected/controllers/SiteController.php | 13 +++++ apps/benchmark/protected/vendor/.gitignore | 2 + 6 files changed, 141 insertions(+) create mode 100644 apps/benchmark/LICENSE.md create mode 100644 apps/benchmark/README.md create mode 100644 apps/benchmark/composer.json create mode 100644 apps/benchmark/index.php create mode 100644 apps/benchmark/protected/controllers/SiteController.php create mode 100644 apps/benchmark/protected/vendor/.gitignore diff --git a/apps/benchmark/LICENSE.md b/apps/benchmark/LICENSE.md new file mode 100644 index 0000000..6edcc4f --- /dev/null +++ b/apps/benchmark/LICENSE.md @@ -0,0 +1,32 @@ +The Yii framework is free software. It is released under the terms of +the following BSD License. + +Copyright © 2008-2013 by Yii Software LLC (http://www.yiisoft.com) +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Yii Software LLC nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/apps/benchmark/README.md b/apps/benchmark/README.md new file mode 100644 index 0000000..2aeb0ae --- /dev/null +++ b/apps/benchmark/README.md @@ -0,0 +1,56 @@ +Yii 2 Benchmark Application +=========================== + +**NOTE** Yii 2 and the relevant applications and extensions are still under heavy +development. We may make significant changes without prior notices. Please do not +use them for production. Please consider using [Yii v1.1](https://github.com/yiisoft/yii) +if you have a project to be deployed for production soon. + + +Yii 2 Benchmark Application is an application built to demonstrate the minimal overhead +introduced by the Yii framework. The application contains a single page which only renders +the "hello world" string. + +The application attempts to simulate the scenario in which you can achieve the best performance +when using Yii. It does so by assuming that both of the main application configuration and the page +content are cached in memory, and the application enables pretty URLs. + + +DIRECTORY STRUCTURE +------------------- + + protected/ contains application source code + controllers/ contains Web controller classes + index.php the entry script + + +REQUIREMENTS +------------ + +The minimum requirement by Yii is that your Web server supports PHP 5.3.?. + + +INSTALLATION +------------ + +If you do not have [Composer](http://getcomposer.org/), you may download it from +[http://getcomposer.org/](http://getcomposer.org/) or run the following command on Linux/Unix/MacOS: + +~~~ +curl -s http://getcomposer.org/installer | php +~~~ + +You can then install the Bootstrap Application using the following command: + +~~~ +php composer.phar create-project --stability=dev yiisoft/yii2-app-benchmark yii-benchmark +~~~ + +Now you should be able to access the benchmark page using the URL + +~~~ +http://localhost/yii-benchmark/index.php/site/hello +~~~ + +In the above, we assume `yii-benchmark` is directly under the document root of your Web server. + diff --git a/apps/benchmark/composer.json b/apps/benchmark/composer.json new file mode 100644 index 0000000..4805f4f --- /dev/null +++ b/apps/benchmark/composer.json @@ -0,0 +1,20 @@ +{ + "name": "yiisoft/yii2-app-benchmark", + "description": "Yii 2 Benchmark Application", + "keywords": ["yii", "framework", "benchmark", "application"], + "homepage": "http://www.yiiframework.com/", + "type": "project", + "license": "BSD-3-Clause", + "support": { + "issues": "https://github.com/yiisoft/yii2/issues?state=open", + "forum": "http://www.yiiframework.com/forum/", + "wiki": "http://www.yiiframework.com/wiki/", + "irc": "irc://irc.freenode.net/yii", + "source": "https://github.com/yiisoft/yii2" + }, + "minimum-stability": "dev", + "require": { + "php": ">=5.3.0", + "yiisoft/yii2": "dev-master" + } +} diff --git a/apps/benchmark/index.php b/apps/benchmark/index.php new file mode 100644 index 0000000..ddf6081 --- /dev/null +++ b/apps/benchmark/index.php @@ -0,0 +1,18 @@ + 'benchmark', + 'basePath' => __DIR__ . '/protected', + 'components' => array( + 'urlManager' => array( + 'enablePrettyUrl' => true, + ), + ) +); + +$application = new yii\web\Application($config); +$application->run(); diff --git a/apps/benchmark/protected/controllers/SiteController.php b/apps/benchmark/protected/controllers/SiteController.php new file mode 100644 index 0000000..16089d0 --- /dev/null +++ b/apps/benchmark/protected/controllers/SiteController.php @@ -0,0 +1,13 @@ +