For Programmers: Free Programming Magazines  


Home > Archive > PHP Documentation > May 2004 > cvs: livedocs / xml_classes5.php









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author cvs: livedocs / xml_classes5.php
Ilia Alshanetsky

2004-05-26, 1:36 pm

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/livedoc...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)
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com