Each benchmarked tool source code is divided in 2 repositories.
Example with Twig :
phpbenchmarks/twig: Twig installation, without benchmark source code.
- A branch per minor Twig version, and per benchmark. Example: twig_2.4_hello-world.
- Contains init_benchmark.sh, with init() function who initiate benchmark: composer install, clear caches etc.
- Twig benchmarked version as dependency (forced major and minor, example 2.4.*) and phpbenchmark/twig-common.
- phpbenchmarks/twig-common: benchmark source code.
Template engine installation
Once repositories are created, clone them, create your branches and install the template engine (Plates 3.3 in this example).
Template engine installation repository
cd /var/www git clone https://github.com/phpbenchmarks/plates.git cd plates git checkout -b plates_3.3_prepare # Installez votre moteur de template composer require league/plates:3.3.* composer update
Create first commit with default template engine installation
git add . git commit -m "Default installation" git push origin plates_3.3_prepare
cd /var/www git clone https://github.com/phpbenchmarks/plates-common.git cd plates-common git checkout -b plates_3_prepare touch README.md git add README.md git commit -m "Create branch" git push origin plates_3_prepare
Features for all benchmarks
To create each benchmarks, you should add this features (or some of them, juste tell us features aren't implemented):
- Create a layout layout.html, who will be extended by overload.html template
- 2 functions, who contains echo 'PHP Benchmarks', in an external file and call them
- 2 macros, who contains echo 'PHP Benchmarks', in an external file and call them
- 2 strings escaping for HTML
- 2 strings escaping for JS
- 2 variables assignment (text should contains HTML) and echo their content without escaping the HTML
- 2 display of unknown variables (should not throw an exception)
- Create a OverloadObject class, pass an instance to overload.html and display phpBenchmarks() method call on this object, who return PHP Benchmarks
- 2 templates inclusions, pass them a variable and display it
- 2 blocks into layout.html, overloaded into overload.html who displays PHP Benchmarks
That's all folks !
PHP benchmarks appreciate all participations, even if you don't implement all features!