You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Michael Thome (JIRA)" <ax...@ws.apache.org> on 2005/03/09 20:25:52 UTC

[jira] Created: (AXIS-1862) Significant performance problem with NodeImpl.getOwnerDocument

Significant performance problem with NodeImpl.getOwnerDocument
--------------------------------------------------------------

         Key: AXIS-1862
         URL: http://issues.apache.org/jira/browse/AXIS-1862
     Project: Axis
        Type: Bug
  Components: Serialization/Deserialization  
    Versions: 1.2RC2, 1.2, 1.2RC3    
    Reporter: Michael Thome
    Priority: Critical


The implementation of org.apache.axis.message.NodeImpl.getOwnerDocument uses an extremely poor algorithm: something like O(2^(n-1)) where n is the distance from one node to an ancestor node with an owner document.  This is a real killer for web services that pass deep structures around.

A proposed patch will follow.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (AXIS-1862) Significant performance problem with NodeImpl.getOwnerDocument

Posted by "Davanum Srinivas (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS-1862?page=history ]
     
Davanum Srinivas resolved AXIS-1862:
------------------------------------

    Resolution: Fixed

Applied the patch for RC3.

thanks,
dims

> Significant performance problem with NodeImpl.getOwnerDocument
> --------------------------------------------------------------
>
>          Key: AXIS-1862
>          URL: http://issues.apache.org/jira/browse/AXIS-1862
>      Project: Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2RC2, 1.2, 1.2RC3
>     Reporter: Michael Thome
>     Priority: Critical
>  Attachments: NodeImpl.patch, NodeImpl12RC3.diff
>
> The implementation of org.apache.axis.message.NodeImpl.getOwnerDocument uses an extremely poor algorithm: something like O(2^(n-1)) where n is the distance from one node to an ancestor node with an owner document.  This is a real killer for web services that pass deep structures around.
> A proposed patch will follow.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Updated: (AXIS-1862) Significant performance problem with NodeImpl.getOwnerDocument

Posted by "Michael Thome (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS-1862?page=history ]

Michael Thome updated AXIS-1862:
--------------------------------

    Attachment: NodeImpl.patch

This patch dramatically improves performance in my index cases.  The time required to deserialize a reasonably small (1KB) but structurally-deep message dropped from 10 seconds (3/4 of the time spent in NodeImpl.getOwnerDocument and MessageElement.getOwnerDocument) to less than 2 seconds (*.getOwnerDocument < .1% of time).

The two issues with the original code are:
1. getOwnerDocument is both (a) called recursively on the parent and (b) the parent chain is iterated over within the method (this only has an effect when there isn't a document in parent chain).
2. when parent.getOwnerDocument returns a non-null value, it is re-invoked to return that value. (this only has an effect when there IS a document in the parent chain).

Note that there is a potential further optimization which may be available depending on the semantics required by axis (and Node): if these Nodes may never be "owned by" more than one document in their lifetimes, then a non-null document returned from a parent may be cached for later use.  It appears unlikely that this would make a significant difference in any real-world situation, so although I raise the possibility, I'd recommend leaving it out.

> Significant performance problem with NodeImpl.getOwnerDocument
> --------------------------------------------------------------
>
>          Key: AXIS-1862
>          URL: http://issues.apache.org/jira/browse/AXIS-1862
>      Project: Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2RC2, 1.2, 1.2RC3
>     Reporter: Michael Thome
>     Priority: Critical
>  Attachments: NodeImpl.patch
>
> The implementation of org.apache.axis.message.NodeImpl.getOwnerDocument uses an extremely poor algorithm: something like O(2^(n-1)) where n is the distance from one node to an ancestor node with an owner document.  This is a real killer for web services that pass deep structures around.
> A proposed patch will follow.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Updated: (AXIS-1862) Significant performance problem with NodeImpl.getOwnerDocument

Posted by "Michael Thome (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS-1862?page=history ]

Michael Thome updated AXIS-1862:
--------------------------------

    Attachment: NodeImpl12RC3.diff

Here is a patch for 1.2RC3
1.2rc3 had already correct one of the two sides of this problem.  e.g. it performs satisfactorily when the node.getOwnerDocument is going to return something other than null.

Remaining in RC3 is a somewhat different performance problem (see point 1 above) that arises if a structure is not connected to a document.  In this case, there is no point in walking up the tree because it will have already performed the same test - essentially the unpatched code is both iterating up the parent chain as well as recursing up the chain at each step.

For my particular test case, axis is always operating on connected-to-document node trees, so no - rc3 does not exhibit the same bad performance that rc2 did.  I included rc3 in the report because of the remaining issue, which may or may not arise in practice but is certainly still a coding error.

The priority ought to be downgraded, given the lack of know real-world performance gain against RC3.

> Significant performance problem with NodeImpl.getOwnerDocument
> --------------------------------------------------------------
>
>          Key: AXIS-1862
>          URL: http://issues.apache.org/jira/browse/AXIS-1862
>      Project: Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2RC2, 1.2, 1.2RC3
>     Reporter: Michael Thome
>     Priority: Critical
>  Attachments: NodeImpl.patch, NodeImpl12RC3.diff
>
> The implementation of org.apache.axis.message.NodeImpl.getOwnerDocument uses an extremely poor algorithm: something like O(2^(n-1)) where n is the distance from one node to an ancestor node with an owner document.  This is a real killer for web services that pass deep structures around.
> A proposed patch will follow.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS-1862) Significant performance problem with NodeImpl.getOwnerDocument

Posted by "Davanum Srinivas (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS-1862?page=comments#action_60521 ]
     
Davanum Srinivas commented on AXIS-1862:
----------------------------------------

Michael,

Can you please submit a patch against RC3 (or latest CVS?) The patch you submitted is against an old version and some things have changed. Did you REALLY have this problem in 1.2RC3?

thanks,
dims


> Significant performance problem with NodeImpl.getOwnerDocument
> --------------------------------------------------------------
>
>          Key: AXIS-1862
>          URL: http://issues.apache.org/jira/browse/AXIS-1862
>      Project: Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2RC2, 1.2, 1.2RC3
>     Reporter: Michael Thome
>     Priority: Critical
>  Attachments: NodeImpl.patch
>
> The implementation of org.apache.axis.message.NodeImpl.getOwnerDocument uses an extremely poor algorithm: something like O(2^(n-1)) where n is the distance from one node to an ancestor node with an owner document.  This is a real killer for web services that pass deep structures around.
> A proposed patch will follow.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira