Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP parse_ini_file() performance?

Tags:

php

ini

I know some people store settings in an .ini file and get the values with parse_ini_file() in PHP. Without running tests, I am curious about performance.

Do you know if opcode cache can cache any of this type of stuff if setting are in an ini file?

like image 547
JasonDavis Avatar asked Jan 22 '10 20:01

JasonDavis


1 Answers

According to this old blog post retrieved from web archives.

From fastest to slowest:

  1. Serialized arrays
  2. Plain PHP code
  3. INI files
  4. XML files
  5. YAML files

EDIT (08/02/2012)

If APC or other accelerator is available on the server plain PHP files would be the fastest due to fact that they will be parsed only once and kept in memory for further use.

like image 134
Crozin Avatar answered Oct 14 '22 10:10

Crozin