You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by "Andreas Veithen (JIRA)" <ji...@apache.org> on 2008/01/14 22:47:34 UTC

[jira] Updated: (WSCOMMONS-294) Inefficient string concatenation in OMElementImpl#getText

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

Andreas Veithen updated WSCOMMONS-294:
--------------------------------------

    Attachment: Test.java

Attached a test that provides evidence for the problem described here. Execution of OMElementImpl#getText takes about 3.5s. When the test string "0123456789" is replaced by "012345678<", execution time rises to 27.5s. The reason is that when the text contains XML entities, the parser (Woodstox) seems to return smaller chunks (500 characters instead of about 4000). This would explain the problem described in the thread cited above (where processing time is very large for XHTML, but not for text without XML entities). When OMElementImpl#getText is modified to use a StringBuffer, execution time falls to 0.1s or less (depending on whether the text contains entities or not).

> Inefficient string concatenation in OMElementImpl#getText
> ---------------------------------------------------------
>
>                 Key: WSCOMMONS-294
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-294
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>            Reporter: Andreas Veithen
>         Attachments: Test.java
>
>
> The getText method in org.apache.axiom.om.impl.llom.OMElementImpl uses the plus operator to do repetitive string concatenations. This leads to rapid performance degradation when the element contains a large number of text nodes. This may happen in particular when the XMLStreamReader is not coalescing. I believe that this is the root cause of the problem described in the following thread:
> http://www.nabble.com/Process-SOAP-message-containg-XHTML-to14804315.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org