Enrico Scoda created XERCESJ-1630:
-------------------------------------

             Summary: DeepNodeListImpl cache should not be invalidated by 
Element.setAttribute()
                 Key: XERCESJ-1630
                 URL: https://issues.apache.org/jira/browse/XERCESJ-1630
             Project: Xerces2-J
          Issue Type: Improvement
          Components: DOM (Level 3 Core)
    Affects Versions: 2.11.0
            Reporter: Enrico Scoda


Consider the task of looping through a node list of elements to set an 
attribute on each of them. This task can be very expensive (seconds for some 
thousands elements). 
The cause is the node list cache (the array list) being invalidated by each 
call to setAttribute(). DeepNodeListImpl "cache" should be invalidated only by 
structural changes (insertion or removal of nodes).
AttrImpl.setValue() is calling changed() in the "directly store string" branch.
Even considering to support HTMLDocumentImpl.getElementsByName(), changed() 
could be called only when attribute is "name":

if ("name".equals(name)) {
    changed();
}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to