Update of /cvsroot/phpxd/phpXD/include
In directory usw-pr-cvs1:/tmp/cvs-serv2696/include
Modified Files:
node.php
Log Message:
Speed up with factor 10 cause Node() no longer uses uniqid() which is
quite slow. Instead the a combination of microtime and rand is used.
Index: node.php
===================================================================
RCS file: /cvsroot/phpxd/phpXD/include/node.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** node.php 2001/11/27 20:32:34 1.4
--- node.php 2001/11/27 20:58:25 1.5
***************
*** 222,227 ****
*/
function Node() {
! srand((double)microtime()*1000000);
! $this->nodeID = md5(uniqid(rand()));
}
--- 222,226 ----
*/
function Node() {
! $this->nodeID = microtime()." ".rand();
}
***************
*** 908,937 ****
return 0;
- }
-
- /**
- * Same as appendChild, but no check whether the new child is a valid child
- * type, if it has a parent or if it has siblings;
- * Used to speed up loading a file; Be careful if you use this method.
- *
- * @private
- * @param $newChild <a href="Node.html">Node</a>
- * @returns void
- */
- function &appendChildFast(&$newChild) {
- $newChild->parentNode = &$this;
- $newChild->ownerDocument = &$this->ownerDocument;
-
- if (!isset($this->firstChild)) {
- $this->firstChild = &$newChild;
- $this->lastChild = &$newChild;
- $this->childNodes = new NodeList();
- }
- else {
- $this->lastChild->nextSibling = &$newChild;
- $newChild->previousSibling = &$this->lastChild;
- $this->lastChild = &$newChild;
- }
- $this->childNodes->insertNode($newChild);
}
}
--- 907,910 ----
|