You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "John Krueger (JIRA)" <ji...@apache.org> on 2007/09/14 23:46:35 UTC

[jira] Created: (WW-2183) The xslt result type is extremely slow for actions that produce a large xml document.

The xslt result type is extremely slow for actions that produce a large xml document.
-------------------------------------------------------------------------------------

                 Key: WW-2183
                 URL: https://issues.apache.org/struts/browse/WW-2183
             Project: Struts 2
          Issue Type: Improvement
          Components: Views
    Affects Versions: 2.0.10, 2.0.9, 2.0.8, 2.0.7, 2.0.6
         Environment: Operating system: Linux, Windows XP
            Reporter: John Krueger
         Attachments: patch.txt

XSL transformations take what seems like an exponential increase in time with respect to the size of the xml document produced from the action.  I ran our app through a profiler and determined almost all of the time was being spent in a couple of log statements in the following method from the class, org.apache.struts2.views.xslt.AbstractAdapterNode.

    public Node getChildBeforeOrAfter(Node child, boolean before) {
        log.debug("getChildBeforeOrAfter: ");
        List adapters = getChildAdapters();
        log.debug("childAdapters = " + adapters);
        log.debug("child = " + child);

        int index = adapters.indexOf(child);
        if (index < 0)
            throw new StrutsException(child + " is no child of " + this);
        int siblingIndex = before ? index - 1 : index + 1;
        return ((0 < siblingIndex) && (siblingIndex < adapters.size())) ?
                ((Node) adapters.get(siblingIndex)) : null;
    }

This method gets called very frequently while the transformer is traversing the document, multiple times for each node.  Since there is not a guard around the debug statements, the toString method on the adapters and child variables is called even when not in debug mode.  I added the guard if (log.isDebugEnabled()) around the two lines and the transformation only took about 4 seconds instead of 80+ seconds for our action which returned about 1000 users.


I created a patch and will attach it to this ticket.  This is the first time that I have created a patch using subversion so let me know if I am missing something.  It would be nice if this could be back ported to 2.0.X since we are using that branch for the time being.



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


[jira] Resolved: (WW-2183) XSLT result type is extremely slow for actions that produce a large xml document

Posted by "James Holmes (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2183?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Holmes resolved WW-2183.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.1.0

Many thanks for the patch. Keep 'em coming!

Fixed on the Struts 2_0_X branch in SVN revision 575840. 

Fixed on the trunk (Struts 2.1) in SVN revision 575841. 

> XSLT result type is extremely slow for actions that produce a large xml document
> --------------------------------------------------------------------------------
>
>                 Key: WW-2183
>                 URL: https://issues.apache.org/struts/browse/WW-2183
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Views
>    Affects Versions: 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.0.10
>         Environment: Operating system: Linux, Windows XP
>            Reporter: John Krueger
>            Assignee: James Holmes
>             Fix For: 2.0.11, 2.1.0
>
>         Attachments: patch.txt
>
>
> XSL transformations take what seems like an exponential increase in time with respect to the size of the xml document produced from the action.  I ran our app through a profiler and determined almost all of the time was being spent in a couple of log statements in the following method from the class, org.apache.struts2.views.xslt.AbstractAdapterNode.
>     public Node getChildBeforeOrAfter(Node child, boolean before) {
>         log.debug("getChildBeforeOrAfter: ");
>         List adapters = getChildAdapters();
>         log.debug("childAdapters = " + adapters);
>         log.debug("child = " + child);
>         int index = adapters.indexOf(child);
>         if (index < 0)
>             throw new StrutsException(child + " is no child of " + this);
>         int siblingIndex = before ? index - 1 : index + 1;
>         return ((0 < siblingIndex) && (siblingIndex < adapters.size())) ?
>                 ((Node) adapters.get(siblingIndex)) : null;
>     }
> This method gets called very frequently while the transformer is traversing the document, multiple times for each node.  Since there is not a guard around the debug statements, the toString method on the adapters and child variables is called even when not in debug mode.  I added the guard if (log.isDebugEnabled()) around the two lines and the transformation only took about 4 seconds instead of 80+ seconds for our action which returned about 1000 users.
> I created a patch and will attach it to this ticket.  This is the first time that I have created a patch using subversion so let me know if I am missing something.  It would be nice if this could be back ported to 2.0.X since we are using that branch for the time being.

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


[jira] Updated: (WW-2183) The xslt result type is extremely slow for actions that produce a large xml document.

Posted by "James Holmes (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2183?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Holmes updated WW-2183:
-----------------------------

            Flags: [Patch, Important]  (was: [Important, Patch])
    Fix Version/s: 2.0.11

> The xslt result type is extremely slow for actions that produce a large xml document.
> -------------------------------------------------------------------------------------
>
>                 Key: WW-2183
>                 URL: https://issues.apache.org/struts/browse/WW-2183
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Views
>    Affects Versions: 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.0.10
>         Environment: Operating system: Linux, Windows XP
>            Reporter: John Krueger
>             Fix For: 2.0.11
>
>         Attachments: patch.txt
>
>
> XSL transformations take what seems like an exponential increase in time with respect to the size of the xml document produced from the action.  I ran our app through a profiler and determined almost all of the time was being spent in a couple of log statements in the following method from the class, org.apache.struts2.views.xslt.AbstractAdapterNode.
>     public Node getChildBeforeOrAfter(Node child, boolean before) {
>         log.debug("getChildBeforeOrAfter: ");
>         List adapters = getChildAdapters();
>         log.debug("childAdapters = " + adapters);
>         log.debug("child = " + child);
>         int index = adapters.indexOf(child);
>         if (index < 0)
>             throw new StrutsException(child + " is no child of " + this);
>         int siblingIndex = before ? index - 1 : index + 1;
>         return ((0 < siblingIndex) && (siblingIndex < adapters.size())) ?
>                 ((Node) adapters.get(siblingIndex)) : null;
>     }
> This method gets called very frequently while the transformer is traversing the document, multiple times for each node.  Since there is not a guard around the debug statements, the toString method on the adapters and child variables is called even when not in debug mode.  I added the guard if (log.isDebugEnabled()) around the two lines and the transformation only took about 4 seconds instead of 80+ seconds for our action which returned about 1000 users.
> I created a patch and will attach it to this ticket.  This is the first time that I have created a patch using subversion so let me know if I am missing something.  It would be nice if this could be back ported to 2.0.X since we are using that branch for the time being.

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


[jira] Updated: (WW-2183) XSLT result type is extremely slow for actions that produce a large xml document

Posted by "James Holmes (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2183?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Holmes updated WW-2183:
-----------------------------

       Flags: [Patch, Important]  (was: [Important, Patch])
    Assignee: James Holmes
     Summary: XSLT result type is extremely slow for actions that produce a large xml document  (was: The xslt result type is extremely slow for actions that produce a large xml document.)

> XSLT result type is extremely slow for actions that produce a large xml document
> --------------------------------------------------------------------------------
>
>                 Key: WW-2183
>                 URL: https://issues.apache.org/struts/browse/WW-2183
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Views
>    Affects Versions: 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.0.10
>         Environment: Operating system: Linux, Windows XP
>            Reporter: John Krueger
>            Assignee: James Holmes
>             Fix For: 2.0.11
>
>         Attachments: patch.txt
>
>
> XSL transformations take what seems like an exponential increase in time with respect to the size of the xml document produced from the action.  I ran our app through a profiler and determined almost all of the time was being spent in a couple of log statements in the following method from the class, org.apache.struts2.views.xslt.AbstractAdapterNode.
>     public Node getChildBeforeOrAfter(Node child, boolean before) {
>         log.debug("getChildBeforeOrAfter: ");
>         List adapters = getChildAdapters();
>         log.debug("childAdapters = " + adapters);
>         log.debug("child = " + child);
>         int index = adapters.indexOf(child);
>         if (index < 0)
>             throw new StrutsException(child + " is no child of " + this);
>         int siblingIndex = before ? index - 1 : index + 1;
>         return ((0 < siblingIndex) && (siblingIndex < adapters.size())) ?
>                 ((Node) adapters.get(siblingIndex)) : null;
>     }
> This method gets called very frequently while the transformer is traversing the document, multiple times for each node.  Since there is not a guard around the debug statements, the toString method on the adapters and child variables is called even when not in debug mode.  I added the guard if (log.isDebugEnabled()) around the two lines and the transformation only took about 4 seconds instead of 80+ seconds for our action which returned about 1000 users.
> I created a patch and will attach it to this ticket.  This is the first time that I have created a patch using subversion so let me know if I am missing something.  It would be nice if this could be back ported to 2.0.X since we are using that branch for the time being.

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


[jira] Updated: (WW-2183) The xslt result type is extremely slow for actions that produce a large xml document.

Posted by "John Krueger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2183?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

John Krueger updated WW-2183:
-----------------------------

    Attachment: patch.txt

this patch improves performance of the xslt result type

> The xslt result type is extremely slow for actions that produce a large xml document.
> -------------------------------------------------------------------------------------
>
>                 Key: WW-2183
>                 URL: https://issues.apache.org/struts/browse/WW-2183
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Views
>    Affects Versions: 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.0.10
>         Environment: Operating system: Linux, Windows XP
>            Reporter: John Krueger
>         Attachments: patch.txt
>
>
> XSL transformations take what seems like an exponential increase in time with respect to the size of the xml document produced from the action.  I ran our app through a profiler and determined almost all of the time was being spent in a couple of log statements in the following method from the class, org.apache.struts2.views.xslt.AbstractAdapterNode.
>     public Node getChildBeforeOrAfter(Node child, boolean before) {
>         log.debug("getChildBeforeOrAfter: ");
>         List adapters = getChildAdapters();
>         log.debug("childAdapters = " + adapters);
>         log.debug("child = " + child);
>         int index = adapters.indexOf(child);
>         if (index < 0)
>             throw new StrutsException(child + " is no child of " + this);
>         int siblingIndex = before ? index - 1 : index + 1;
>         return ((0 < siblingIndex) && (siblingIndex < adapters.size())) ?
>                 ((Node) adapters.get(siblingIndex)) : null;
>     }
> This method gets called very frequently while the transformer is traversing the document, multiple times for each node.  Since there is not a guard around the debug statements, the toString method on the adapters and child variables is called even when not in debug mode.  I added the guard if (log.isDebugEnabled()) around the two lines and the transformation only took about 4 seconds instead of 80+ seconds for our action which returned about 1000 users.
> I created a patch and will attach it to this ticket.  This is the first time that I have created a patch using subversion so let me know if I am missing something.  It would be nice if this could be back ported to 2.0.X since we are using that branch for the time being.

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