iliaa Wed May 26 12:18:02 2004 EDT
Modified files: /livedocs xml_classes5.php Log: Unroll set_parent() another 5-7% speed boost. http://cvs.php.net/diff.php/livedocs/xml_classes5.php?r1=1.5&r2=1.6&ty=u Index: livedocs/xml_classes5.php diff -u livedocs/xml_classes5.php:1.5 livedocs/xml_classes5.php:1.6 --- livedocs/xml_classes5.php:1.5 Wed May 26 10:24:55 2004 +++ livedocs/xml_classes5.php Wed May 26 12:18:01 2004 @@ -19,7 +19,7 @@ // | PHP 5 style | // +----------------------------------------------------------------------+ // -// $Id: xml_classes5.php,v 1.5 2004/05/26 14:24:55 iliaa Exp $ +// $Id: xml_classes5.php,v 1.6 2004/05/26 16:18:01 iliaa Exp $ class Node { /* {{{ */ @@ -141,12 +141,6 @@ @$GLOBALS['__node_count']++; } - function set_parent($parent) - { - $this->parent = $parent; - $parent->children[] = $this; - } - function compress() { if (count($this->children) == 1 && $this->children[0]->tagname == '') { @@ -188,11 +182,15 @@ // promote content to an anonymous cdata node $node = new Node("", array()); $node->content = $this->content; - $node->set_parent($this); + /* set_parent */ + $node->parent = $this; + $this->children[] = $node; } $this->content = ""; } - $child->set_parent($this); + /* set_parent */ + $child->parent = $this; + $this->children[] = $child; } function add_cdata($data)