ICEfaces
  1. ICEfaces
  2. ICE-734

Tree performance issue with > 300 nodes on a branch

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5
    • Fix Version/s: 1.6.2, 1.7DR#1, 1.7
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      Operating System: Windows XP
      Platform: PC

      Description

      Need to investigate tree performance optimizations. Noted in forum:
      http://support.icesoft.com/jive/thread.jspa?threadID=1974&tstart=0
      1. bigbody.html
        37 kB
        Ted Goddard
      2. bigform-innerHTML.html
        1 kB
        Ted Goddard
      3. dynamicBigForm2.html
        1 kB
        Ted Goddard

        Activity

        Hide
        Jean-brice Rougeot added a comment -

        I have around 50 nodes directly under root node which works fast in mozilla but really slow in IE. My TreeNode extends IceUserObject and is composed of a few members.
        It seems the problem is related to DOM management in IE, even because the same component works fine with Mozilla.

        Show
        Jean-brice Rougeot added a comment - I have around 50 nodes directly under root node which works fast in mozilla but really slow in IE. My TreeNode extends IceUserObject and is composed of a few members. It seems the problem is related to DOM management in IE, even because the same component works fine with Mozilla.
        Hide
        Ted Goddard added a comment -

        Are the tree nodes themselves complex? We might be able to help by looking at the specific application.

        Show
        Ted Goddard added a comment - Are the tree nodes themselves complex? We might be able to help by looking at the specific application.
        Hide
        Jean-brice Rougeot added a comment -

        Hi,
        Icefaces tree 2.0 is still very slow in Internet explorer, is there any workaround?

        Show
        Jean-brice Rougeot added a comment - Hi, Icefaces tree 2.0 is still very slow in Internet explorer, is there any workaround?
        Hide
        Jean-brice Rougeot added a comment -

        Hi,
        Icefaces tree 2.0 is still very slow in Internet explorer, is there any workaround?

        Show
        Jean-brice Rougeot added a comment - Hi, Icefaces tree 2.0 is still very slow in Internet explorer, is there any workaround?
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Assignee Mircea Toma [ mircea.toma ]
        Ken Fyten made changes -
        Fix Version/s 1.7 [ 10080 ]
        Mircea Toma made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Mircea Toma added a comment -

        Applied fix to 1.6 branch.

        Show
        Mircea Toma added a comment - Applied fix to 1.6 branch.
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #14999 Mon Oct 22 12:43:31 MDT 2007 mircea.toma Fix 'for' loops to use precalculated length.
        Serialize view numbers once per submit.
        Fix form element retrieval for Safari.
        Remove check for duplicate parameters (check rendered useless due to previously mentioned fix).
        Test if component can submit before serializing it (when iceSubmit/icePartialSubmit is called).
        Anchor elements can submit forms, so serialize accordingly.

        ICE-734
        Files Changed
        Commit graph MODIFY /icefaces/branches/icefaces-1.6/icefaces/bridge/lib/parameters.js
        Commit graph MODIFY /icefaces/branches/icefaces-1.6/icefaces/bridge/lib/event.js
        Commit graph MODIFY /icefaces/branches/icefaces-1.6/icefaces/bridge/lib/enumerator.js
        Commit graph MODIFY /icefaces/branches/icefaces-1.6/icefaces/bridge/src/submit.js
        Commit graph MODIFY /icefaces/branches/icefaces-1.6/icefaces/bridge/lib/element.js
        Ken Fyten made changes -
        Assignee Philip Breau [ philip.breau ] Mircea Toma [ mircea.toma ]
        Ken Fyten made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Ken Fyten made changes -
        Fix Version/s 1.6.2 [ 10111 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #14874 Thu Sep 27 17:57:32 MDT 2007 mircea.toma Anchor elements can submit forms, so serialize accordingly -- ICE-734
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/bridge/lib/element.js
        Ken Fyten made changes -
        Issue Type Bug [ 1 ] Improvement [ 4 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #14871 Wed Sep 26 16:26:58 MDT 2007 mircea.toma Test if component can submit before serializing it (when iceSubmit/icePartialSubmit is called) -- ICE-734
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/bridge/lib/element.js
        Commit graph MODIFY /icefaces/trunk/icefaces/bridge/src/submit.js
        Ted Goddard made changes -
        Fix Version/s 1.7DR#1 [ 10100 ]
        Assignee Mircea Toma [ mircea.toma ] Philip Breau [ philip.breau ]
        Hide
        Ted Goddard added a comment -

        Significant improvement to complex page performance is an important bug fix for several customers, it's worth highlighting in the 1.7DR#1 release notes.

        Philip, do you have a test case for large numbers of row selectors? We should verify that this fix helps in that case as well.

        Show
        Ted Goddard added a comment - Significant improvement to complex page performance is an important bug fix for several customers, it's worth highlighting in the 1.7DR#1 release notes. Philip, do you have a test case for large numbers of row selectors? We should verify that this fix helps in that case as well.
        Mircea Toma made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Mircea Toma added a comment -

        Fix 'for' loops to use precalculated length.
        Serialize view numbers only once per submit.
        Fix form element retrieval for Safari.
        Remove check for duplicate parameters (check rendered useless due to previously mentioned fix).

        Show
        Mircea Toma added a comment - Fix 'for' loops to use precalculated length. Serialize view numbers only once per submit. Fix form element retrieval for Safari. Remove check for duplicate parameters (check rendered useless due to previously mentioned fix).
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #14841 Wed Sep 19 17:39:26 MDT 2007 mircea.toma Fix 'for' loops to use precalculated length.
        Serialize view numbers once per submit.
        Fix form element retrieval for Safari.
        Remove check for duplicate parameters (check rendered useless due to previously mentioned fix).

        ICE-734
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/bridge/lib/element.js
        Commit graph MODIFY /icefaces/trunk/icefaces/bridge/lib/enumerator.js
        Commit graph MODIFY /icefaces/trunk/icefaces/bridge/lib/event.js
        Commit graph MODIFY /icefaces/trunk/icefaces/bridge/lib/parameters.js
        Commit graph MODIFY /icefaces/trunk/icefaces/bridge/src/submit.js
        Hide
        Ted Goddard added a comment -

        Use of the "var" keyword may not be essential, but further testing indicates that both the array and the index must be kept as local variables.

        More insanely convoluted performance tips here:

        http://blogs.msdn.com/ie/archive/2006/08/28/728654.aspx

        Show
        Ted Goddard added a comment - Use of the "var" keyword may not be essential, but further testing indicates that both the array and the index must be kept as local variables. More insanely convoluted performance tips here: http://blogs.msdn.com/ie/archive/2006/08/28/728654.aspx
        Hide
        Ted Goddard added a comment -

        This version of the loop:

        var formElements = form.elements;
        var length = formElements.length;
        for(i=0; i<length; i++)

        { cat = cat + (formElements[i].value - 0); }

        is many orders of magnitude faster than this version:

        for(i=0; i<form.elements.length; i++)

        { cat = cat + (form.elements[i].value - 0); }

        Experimentation with this "caching" strategy had been tried before, but possibly not with the "var" keyword.

        Show
        Ted Goddard added a comment - This version of the loop: var formElements = form.elements; var length = formElements.length; for(i=0; i<length; i++) { cat = cat + (formElements[i].value - 0); } is many orders of magnitude faster than this version: for(i=0; i<form.elements.length; i++) { cat = cat + (form.elements[i].value - 0); } Experimentation with this "caching" strategy had been tried before, but possibly not with the "var" keyword.
        Hide
        Ted Goddard added a comment -

        It appears that IE can quickly return innerHTML and that innerHTML returns the current state of the form (unlike for Safari or Firefox).

        Hence, innerHTML could be used on IE for efficient form serialization.

        Show
        Ted Goddard added a comment - It appears that IE can quickly return innerHTML and that innerHTML returns the current state of the form (unlike for Safari or Firefox). Hence, innerHTML could be used on IE for efficient form serialization.
        Ted Goddard made changes -
        Attachment bigbody.html [ 10653 ]
        Attachment bigform-innerHTML.html [ 10654 ]
        Hide
        Ted Goddard added a comment -

        The attached files illustrate updating a document via innerHTML. This is rapid in Internet Explorer and IE is able to rapidly iterate through a form updated in this fashion. It appears, therefore, that ICEfaces is currently using DOM APIs to update the page (rather than innerHTML) and this is likely the cause of the performance problems on IE.

        Show
        Ted Goddard added a comment - The attached files illustrate updating a document via innerHTML. This is rapid in Internet Explorer and IE is able to rapidly iterate through a form updated in this fashion. It appears, therefore, that ICEfaces is currently using DOM APIs to update the page (rather than innerHTML) and this is likely the cause of the performance problems on IE.
        Ted Goddard made changes -
        Assignee Mircea Toma [ mircea.toma ]
        Hide
        Ted Goddard added a comment -

        Assigning to Mircea. Note that this is a subtle bug and may require a mixture of strategies to resolve.

        Show
        Ted Goddard added a comment - Assigning to Mircea. Note that this is a subtle bug and may require a mixture of strategies to resolve.
        Ted Goddard made changes -
        Attachment dynamicBigForm2.html [ 10644 ]
        Hide
        Ted Goddard added a comment -

        Further investigation has shown that simply iterating over form elements in Internet Explorer is very inefficient. This is likely due to the architecture of IE, with the DOM and Script memory spaces being entirely separate (almost like the JNI separation between Java and native code). When a DOM node in IE is referenced, it may cause the creation of an associated JavaScript object, and this process is very expensive.

        However, there appear to be ways to cache needed objects within the JavaScript memory space. As the attached example shows, a large form can be dynamically created and processed efficiently provided the dynamic creation of the form employs caching (appendChild() is called with many nodes) and the iteration employs caching (a cache of the form nodes as an array).

        Note that the ultimate problem is to efficiently exchange the results of user interaction with the server, and other strategies are possible (such as purely event-based interaction). Working with forms has the advantage of renderer simplicity, third-party component compatibility and smooth degradation under non-JavaScript scenarios.

        Show
        Ted Goddard added a comment - Further investigation has shown that simply iterating over form elements in Internet Explorer is very inefficient. This is likely due to the architecture of IE, with the DOM and Script memory spaces being entirely separate (almost like the JNI separation between Java and native code). When a DOM node in IE is referenced, it may cause the creation of an associated JavaScript object, and this process is very expensive. However, there appear to be ways to cache needed objects within the JavaScript memory space. As the attached example shows, a large form can be dynamically created and processed efficiently provided the dynamic creation of the form employs caching (appendChild() is called with many nodes) and the iteration employs caching (a cache of the form nodes as an array). Note that the ultimate problem is to efficiently exchange the results of user interaction with the server, and other strategies are possible (such as purely event-based interaction). Working with forms has the advantage of renderer simplicity, third-party component compatibility and smooth degradation under non-JavaScript scenarios.
        Hide
        Ted Goddard added a comment -

        The performance problems may be due to our memory leak prevention strategy on IE rather than form serialization, so there may be options for changing how object references are removed (for instance in small batches in a series of setTimeouts).

        Show
        Ted Goddard added a comment - The performance problems may be due to our memory leak prevention strategy on IE rather than form serialization, so there may be options for changing how object references are removed (for instance in small batches in a series of setTimeouts).
        Ken Fyten made changes -
        Fix Version/s 1.6.1 [ 10070 ]
        Assignee Priority P3
        Assignee Mircea Toma [ mircea.toma ]
        Hide
        Ken Fyten added a comment -

        Further analysis indicates nothing obvious that can be done to further improve the existing tree component under IE. Modifying the components to not require a form may offer the best path forward in terms of reducing the amount of content that must be introduced or removed with each tree node expansion or collapse. The scope of this enhancement makes it an ICEfaces 2.0 concern, however.

        Show
        Ken Fyten added a comment - Further analysis indicates nothing obvious that can be done to further improve the existing tree component under IE. Modifying the components to not require a form may offer the best path forward in terms of reducing the amount of content that must be introduced or removed with each tree node expansion or collapse. The scope of this enhancement makes it an ICEfaces 2.0 concern, however.
        Ken Fyten made changes -
        Assignee Priority P3
        Ken Fyten made changes -
        Fix Version/s 1.6.1 [ 10070 ]
        Ted Goddard made changes -
        Assignee Mircea Toma [ mircea.toma ]
        Hide
        Ted Goddard added a comment -

        This is very likely due to IE JavaScript specifics. Maybe we can adjust the implementation just for IE?

        Is this due to form serialization or to memory leak prevention code?

        (I recall that serializing a form in IE can be done in a fraction of a second even with thousands of nodes.)

        Show
        Ted Goddard added a comment - This is very likely due to IE JavaScript specifics. Maybe we can adjust the implementation just for IE? Is this due to form serialization or to memory leak prevention code? (I recall that serializing a form in IE can be done in a fraction of a second even with thousands of nodes.)
        Philip Breau made changes -
        Resolution Won't Fix [ 2 ]
        Status Closed [ 6 ] Reopened [ 4 ]
        Assignee Greg McCleary [ gregory.mccleary ]
        Show
        Philip Breau added a comment - http://www.icefaces.org/JForum/posts/list/5156.page#23028
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Ken Fyten made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Won't Fix [ 2 ]
        Ken Fyten made changes -
        Fix Version/s 1.6DR#1 [ 10035 ]
        Ken Fyten made changes -
        Resolution Won't Fix [ 2 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Ken Fyten made changes -
        Fix Version/s 1.6DR1 [ 10035 ]
        Fix Version/s 1.6 [ 10031 ]
        Ken Fyten made changes -
        Affects Version/s 1.5 [ 10027 ]
        Affects Version/s 1.0 [ 10024 ]
        Icefaces Administrator made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 747 12003
        Hide
        Greg McCleary added a comment -

        We should re-evaluate the tree performance for the 1.6 release.

        Show
        Greg McCleary added a comment - We should re-evaluate the tree performance for the 1.6 release.
        Show
        Mircea Toma added a comment - Another fix in commit #11852. See explanation at: http://mir.aculo.us/articles/2005/08/28/internet-explorer-and-ajax-image-caching-woes http://www.bazon.net/mishoo/articles.epl?art_id=958 http://support.microsoft.com/default.aspx?scid=kb;en-us;319546
        Hide
        Greg McCleary added a comment -

        More test results:
        Scenario 1:
        100 nodes directly under root node.
        Both browsers perform well.

        Scenario 2:
        200 nodes directly under root node.
        Firefox performs well and IE performance is slightly slower.

        Scenario 3:
        300 nodes directly under root node.
        Firefox is slightly slower and IE performance is poor.

        Scenario 4:
        400 nodes directly under root node.
        Firefox is slower and IE performance is bad.

        Show
        Greg McCleary added a comment - More test results: Scenario 1: 100 nodes directly under root node. Both browsers perform well. Scenario 2: 200 nodes directly under root node. Firefox performs well and IE performance is slightly slower. Scenario 3: 300 nodes directly under root node. Firefox is slightly slower and IE performance is poor. Scenario 4: 400 nodes directly under root node. Firefox is slower and IE performance is bad.
        Hide
        Greg McCleary added a comment -

        Re-opening this bug based on unsatisfactory pre-release testing results from
        DaimlerChrysler.

        Show
        Greg McCleary added a comment - Re-opening this bug based on unsatisfactory pre-release testing results from DaimlerChrysler.
        Hide
        Greg McCleary added a comment -

        A new Iraptor has been filed for the Tree with selectInputDate. See Iraptor #976.

        Some performance results from Philip for the record.
        -------------------------------------
        I'm testing out the tree performance now, and it seems to be significantly
        improved. I can collapse and expand branches with about 100 nodes comprised of
        inputText's and radios in < 10 seconds. The perf is ok up until you get above
        1000 nodes for the whole tree. After that I get the long-script problem again.
        -------------------------------------

        Show
        Greg McCleary added a comment - A new Iraptor has been filed for the Tree with selectInputDate. See Iraptor #976. Some performance results from Philip for the record. ------------------------------------- I'm testing out the tree performance now, and it seems to be significantly improved. I can collapse and expand branches with about 100 nodes comprised of inputText's and radios in < 10 seconds. The perf is ok up until you get above 1000 nodes for the whole tree. After that I get the long-script problem again. -------------------------------------
        Hide
        Greg McCleary added a comment -

        Philip,

        Have noticed any issues around tree performance ?

        I am able to run large trees > 500 nodes in both browsers.

        I see performance issues and out of memory error when I put selectInputDate
        components inside large trees.[ javax.servlet.ServletException:
        java.lang.OutOfMemoryError. ]

        I'm going to open an Iraptor specifically for the selectInputDate in a Tree.

        Show
        Greg McCleary added a comment - Philip, Have noticed any issues around tree performance ? I am able to run large trees > 500 nodes in both browsers. I see performance issues and out of memory error when I put selectInputDate components inside large trees.[ javax.servlet.ServletException: java.lang.OutOfMemoryError. ] I'm going to open an Iraptor specifically for the selectInputDate in a Tree.
        Hide
        Greg McCleary added a comment -

        Bug fixed revision #10058

        The DOM updates have been optimized by assigning IDs to all TreeNode DIVs.
        Prior to this change only the Elements contained in the DIVs were assigned IDs.

        Show
        Greg McCleary added a comment - Bug fixed revision #10058 The DOM updates have been optimized by assigning IDs to all TreeNode DIVs. Prior to this change only the Elements contained in the DIVs were assigned IDs.
        Philip Breau created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Philip Breau
          • Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: