Re: [Config] Extremely slow
| From: | Thorsten Suckow-Homberg | Date: | Wed, 26 Nov 2003 18:26:42 +0000 |
| Subject: | Re: [Config] Extremely slow | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-9162@lists.php.net to get a copy of this message | ||
>In my opinion, this is related to the uniqid() function I use to give a
>unique id to each node so that later I can compare them by reference and
see
>if they are similar.
Right. Using this constructor speeds up things a lot:
/**
* Constructor
*
* @param string $type Type of container object
* @param string $name Name of container object
* @param string $content Content of container object
* @param array $attributes Array of attributes for container object
*/
function Config_Container($type = 'section', $name = '', $content =
'',
$attributes = null)
{
static $iID = 0;
$this->type = $type;
$this->name = $name;
$this->content = $content;
$this->attributes = $attributes;
$this->parent = null;
$this->_id = $iID++;//md5($name.$type);
} // end constructor
Maybe putting $iID into global context would be better (don't know about the
whole class architecture of Config...)
It'd be great if you could fix this as long as we don't know why "uniqid" is
so time-consuming on Linux-Machines...
Nice work guys, at last we tracked this bug down :)