Perf icon

Source code

All benchmarks source codes are available on github.com/phpbenchmarks.

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.
    • Final benchmark source code should be compatible with all minors versions of a major version. Example : 2.*.
    • A branch per major version and per benchmark. Example: twig_2_hello-world.
    • Versioning is explained into README.md.
Perf icon

Increase results

First, retrieve source code of repository you want to increase performances:
git clone https://github.com/phpbenchmarks/twig.git
cd twig
git checkout twig_2.4_hello-world
source init_benchmark.sh && init
Then, create virtual host (don't forget to add it in /etc/hosts), whose configuration may look like that for nginx:
server {
    listen 80;
    server_name benchmark.loc;
    root /var/www/phpbenchmarks/twig/public;
    location / {
        try_files $uri /index.php$is_args$args;
    }
    location ~ ^/(index).php(/|$) {
        fastcgi_pass unix:/run/php/php7.2-fpm.sock;
        fastcgi_split_path_info ^(.+\\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param HTTPS off;
    }
    error_log /var/log/nginx/benchmark_error.log;
    access_log /var/log/nginx/benchmark_access.log;
}
Do your modifications, and send PR for both projects (if needed).
Do not hesitate to add a message in PR to explain how your modifications can increase performances.

We will do some tests with your modifications, and if performances are increased, we will relaunch benchmarks.
You will be credited into benchmark history, like Witold Wasiczko for Zend Framework 3!