[ 
https://issues.apache.org/jira/browse/XERCESJ-102?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Elliotte Rusty Harold resolved XERCESJ-102.
-------------------------------------------
    Resolution: Fixed

  Verdict: long since fixed — the JIRA status is stale   

                    
     What the issue was: XERCESJ-102 ("Parsing gets very slow with lots of 
entity 
     references", status Reopened, last touched 2011) reported O(n²)-style 
parse 
     times because the non-deferred DOM parser concatenated every characters() 
chunk                                              
     onto the existing Text node (old data + new data).                         
      
                    
     When/where it was fixed: commit d632c26a (2002‑03‑19, Elena Litani), "Fix 
to the                                             
     performance bug for non deferred DOM" (Xerces Bugzilla 5602, the duplicate 
                                                  
     tracking the same problem). It introduced fStringBuffer accumulation and   
                                                  
     setCharacterData() flushing at state boundaries. That commit is an 
ancestor of                                               
     current trunk, and the mechanism is still present:                         
                                                  
                                                                                
                                                  
     - src/org/apache/xerces/parsers/AbstractDOMParser.java:1180 — subsequent 
chunks                                              
       fStringBuffer.append(...) instead of re-concatenating the Text node      
                                                  
     - src/org/apache/xerces/parsers/AbstractDOMParser.java:2598 — 
setCharacterData()                                             
       writes the buffer to the node once when state changes (start/end 
element,                                                  
       entity, PI, comment)    

> Parsing gets very slow with lots of entity references
> -----------------------------------------------------
>
>                 Key: XERCESJ-102
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-102
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: DOM (Level 3 Core)
>    Affects Versions: 2.0.0 [beta 4]
>         Environment: Operating System: All
> Platform: All
>            Reporter: Arno de Quaasteniet
>         Attachments: ASF.LICENSE.NOT.GRANTED--testcase.zip
>
>
> When a document contains a large number of enitiy references parsing the 
> document using the DOMParser gets very slow (as in unacceptable slow: 60 sec 
> for a 230kb doc on a PIII 800MHz). This is probably caused by the fact that 
> the 
> character data handler of the DOMParser does not use a stringbuffer to 
> collect 
> the value of a textnode, but instead adds strings together to concatenate 
> them.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

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

Reply via email to