rfussien/dotenv

Performance

Closed this issue · 1 comments

odan commented

Detailed description

On my local machine parse_ini_string with file_get_contents is up to 50% faster then parse_ini_file.

$env = parse_ini_string(file_get_contents('.env'));

vs.

$env = parse_ini_file('.env');

Context

The parser.

Possible implementation

https://github.com/rfussien/dotenv/blob/master/src/Parser.php#L53

$this->content = parse_ini_string(file_get_contents($file), false, $this->scannerMode);

Your environment

  • Version used: PHP 7.1
  • Operating system and version: Windows 7

Hi,
I couldn't see any gain, nether any loss with 7.0, but if you say it's better with 7.1... (cf 7461181)