Skip to content

Small benchmark to measure the loading time of several php dotenv loader

License

Notifications You must be signed in to change notification settings

devudopw/dotenv-benchmark

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

php dotenv loaders benchmark

This is a very small script to show the execution time of dotenv loaders for 10000 executions with 1 iteration.

What is tested ?

Every loader has to reach the same point, so opening the .env file, parsing it and loading the result into $_ENV and $_SERVER.

Where does my results come from ?

But feel free to make yours: edit docker-composer.yml command, revolutions=10000, iterations=1

version: '2'

services:
  benchmark:
    build:
      context: ./
      dockerfile: Dockerfile
    command: php vendor/bin/phpbench run DotenvBench.php --report=aggregate --revs=10000 --iterations=1
# run the benchmark
docker-composer up --build

update composer.json for specific package version

"require": {
        "josegonzalez/dotenv": "@dev",
        "vlucas/phpdotenv": "@dev",
        "rfussien/dotenv": "@dev",
        "symfony/dotenv": "@dev",
        "devcoder-xyz/php-dotenv": "@dev",
        "phpbench/phpbench": "@dev"
    }

Comparaison

  • actual version: @dev
  • 10.000 loops execution time: 149.284μs
  • actual version: @dev
  • 10.000 loops execution time: 400.453μs
  • actual version: ~2.0
  • 10.000 loops execution time: 85.049μs
  • actual version: @dev
  • 10.000 loops execution time: 141.451μs
  • actual version: @dev
  • 10.000 loops execution time: 46.604μs
  • actual version: @dev
  • 10.000 loops execution time: 36.270μs

Raw results

| +-------------+-------------------+-----+-------+-----+----------+-----------+--------+
| | benchmark   | subject           | set | revs  | its | mem_peak | mode      | rstdev |
| +-------------+-------------------+-----+-------+-----+----------+-----------+--------+
| | DotenvBench | benchJosegonzalez |     | 10000 | 1   | 39.390mb | 149.284μs | ±0.00% |
| | DotenvBench | benchVlucas@~2.0  |     | 10000 | 1   | 1.027mb  | 85.049μs  | ±0.00% |
| | DotenvBench | benchVlucas@dev   |     | 10000 | 1   | 1.258mb  | 403.774μs | ±0.00% |
| | DotenvBench | benchSymfony      |     | 10000 | 1   | 1.057mb  | 144.216μs | ±0.00% |
| | DotenvBench | benchRfussien     |     | 10000 | 1   | 1.027mb  | 49.428μs  | ±0.00% |
| | DotenvBench | benchDevcoderxyz  |     | 10000 | 1   | 1.027mb  | 39.376μs  | ±0.00% |
| +-------------+-------------------+-----+-------+-----+----------+-----------+--------+

About

Small benchmark to measure the loading time of several php dotenv loader

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 48.1%
  • Dockerfile 34.3%
  • Shell 17.6%