dom_reconcile_ns performance (or lack thereof)

From: Date: Thu, 14 Mar 2019 19:34:45 +0000
Subject: dom_reconcile_ns performance (or lack thereof)
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-104724@lists.php.net to get a copy of this message
I note that there was some recent discussion about fixing DOMNameSpaceNode on this list. I'd like to bring up a (perhaps) related issue: the dom_reconcile_ns() function which is called whenever a new namespaced node (for example, created with Document#createElementNS) is inserted into the tree. dom_reconcile_ns() does a full walk up to the root of the DOM (via the call to xmlSearchNsByHref) which can create a quadratic slowdown for deeply-nested documents. What is this function doing? Can we do it lazily? Technically HTML elements should be created in the HTML namespace, but doing so leads to extreme performance loss -- parsing a 2MB file goes from 0.4s (with Document#createElement()) to 2.5s (with Document#createElementNS()). --scott -- (http://cscott.net)

« previous php.internals (#104724) next »