[ 
https://issues.apache.org/jira/browse/WSCOMMONS-556?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12919517#action_12919517
 ] 

Andreas Veithen commented on WSCOMMONS-556:
-------------------------------------------

Kasun,

Your changes in DOMUtil also need to be revised because they fail to address 
the fundamental performance issue in that piece of code. Here is the original 
code:

    public static String getLocalName(String qualifiedName) {
        if (qualifiedName.indexOf(DOMUtil.separator) > -1
                && !qualifiedName.trim().endsWith(DOMUtil.separator)) {
            return qualifiedName.split(DOMUtil.separator)[1];
        } else {
            return qualifiedName;
        }
    }

    public static String getPrefix(String qualifiedName) {
        if (qualifiedName.indexOf(DOMUtil.separator) > -1) {
            return qualifiedName.split(DOMUtil.separator)[0];
        } else {
            return null;
        }
    }

The big problem here is the usage of String#split. There are three issues with 
this:

1. The argument to String#split is a regular expression. Therefore, on every 
call, the JRE needs to compile that expression and match the string against 
that pattern. This results in the creation of at least a 
java.util.regex.Pattern and a java.util.regex.Matcher object, and actually lots 
of other objects. This is too much overhead for the simple operation of 
extracting the two parts of the qualified name.

2. It needs to create a String[] object to store the two parts of the qualified 
name. This is unnecessary overhead.

3. It actually needs to create two String objects, but only one is ever used, 
resulting in the creation of one unnecessary String object.

Your change doesn't eliminate any of these problems completely. Combining the 
two methods in a single one only reduces the overhead by less than 50%. There 
is much more potential for optimization here!

> Performance improvement for axiom-dom module
> --------------------------------------------
>
>                 Key: WSCOMMONS-556
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-556
>             Project: WS-Commons
>          Issue Type: Improvement
>          Components: AXIOM
>    Affects Versions: Axiom 1.2.9
>         Environment: Java 1.5
>            Reporter: Kasun Gajasinghe
>            Assignee: Andreas Veithen
>             Fix For: Axiom 1.2.10
>
>         Attachments: axiom-dom-556-patch2.diff, axiom-perf-improvement.diff, 
> FINAL-times_for_large_samples_with_changes.png, 
> FINAL-times_for_small_samples_with_changes.png
>
>
> This article published [0] on April 2010, shows that Axis2 has some major 
> performance issues compared to Metro and CXF.  An analysis suggested that 
> most of the problems were with the axiom-dom module's methods, along with 
> Rampart. So, first we went on improving the axiom-dom module. Here's a patch 
> for the improvements we did.
> Final assessments suggest considerable level improvement.  Graphs for a 
> sample run of requests with small and large samples will be added to the 
> files section.
> [0] http://www.ibm.com/developerworks/java/library/j-jws14/index.html

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

Reply via email to