Actually it isn't. Parsing an ini file is still slower than loading a PHP file. It's never OFTEN slower to load a PHP file but it is going to always be slower to parse an ini file. It may SEEM faster but in real world stress tests parsing is always slower than just loading a php file that has just variable in it.arborint wrote:First let me specifically address this comment. You need to remember that "just including a php file" is often slower than reading in a data file and parsing it. PHP's include parses the file as well.
Configuration files vs Database. Design suggestion
Moderator: General Moderators
- AKA Panama Jack
- Forum Regular
- Posts: 878
- Joined: Mon Nov 14, 2005 4:21 pm
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Ok ... let me get this straight ... you are saying that is it always slower to parse an INI file than to parse a PHP file? Any size? Any kind of data? Always? Do you have benchmarks to back that up?AKA Panama Jack wrote:Actually it isn't. Parsing an ini file is still slower than loading a PHP file. It's never OFTEN slower to load a PHP file but it is going to always be slower to parse an ini file. It may SEEM faster but in real world stress tests parsing is always slower than just loading a php file that has just variable in it.
(#10850)
- AKA Panama Jack
- Forum Regular
- Posts: 878
- Joined: Mon Nov 14, 2005 4:21 pm
It depends upon what is in the ini file and what is in the PHP file.
Parsing an ini file that contains something like this...
will take longer than using an INCLUDE statement to load a php file that contains...
The code that will loop through the data from the ini file to process it into variables will take far longer than a straight include of a php file that is only variables.
Parsing an ini file that contains something like this...
Code: Select all
game_name = "Alien Assault Traders"
server_closed = 1
account_creation_closed = 1
tournament_setup_access = 0
player_limit = 10Code: Select all
<?php
$game_name = "Alien Assault Traders";
$server_closed = 1;
$account_creation_closed = 1;
$tournament_setup_access = 0;
$player_limit = 10;
?>I feel the need...
Sorry, I posted a solution that provides a quick and easy solution, not a fast one.
