Re: [Config] Extremely slow
| From: | Bertrand Mansion | Date: | Wed, 26 Nov 2003 08:47:00 +0000 |
| Subject: | Re: [Config] Extremely slow | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-9149@lists.php.net to get a copy of this message | ||
<wentz@gmx.de> wrote :
> Thorsten Suckow-Homberg wrote:
>>> Parsing XML is slow in PHP. Furthermore, the Config package is slow and
>>> therefore should be used only to manipulate configuration files, not to
>>
>> read
>>
>>> them. If you want a fast solution you can try to wait for PHP 5 and its
>>> SimpleXML parser or have your configuration file be converted by Config to
>>
>> a
>>
>>> PHP array and then access this array directly in PHP (a lot faster).
>>
>>
>> Thx for the answer, but when I mean "slow" I mean "really" slow:
>> Approximately 8 sec for 700 lines ox XML? Is that the way it should be?
>>
>
> i had problems with config & xml, too, i used it to transform a xml-file
> into a php-array, it took about 5-7 secs for 200-300 lines of xml, on a
> linux-machine, haven't tested it on windows...
I have just tested the 670 lines XML on my machine (Powerbook G4/667Mhz
MacOSX PHP 4.3). Here is the code I used:
<?php
require_once('Config.php');
require_once('Benchmark/Timer.php');
$timer = new Benchmark_Timer();
$timer->start();
$config = new Config();
$root = $config->parseConfig('/Volumes/DOC/bigxml.xml', 'xml');
$timer->stop();
$timer->display();
?>
It returned:
time index ex time %
Start 1069836163.79333300 - 0.00%
Stop 1069836164.20870500 0.415371894836 100.00%
total - 0.415371894836 100.00%
That's not 8 seconds or even 5-7 seconds.
Xdebug profiler confirms these figures.
I would be curious what results you get.
Bertrand Mansion
Mamasam