Wicket
  1. Wicket
  2. WICKET-1671

Performance problem with detach (Component.isAuto)

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.3.3
    • Fix Version/s: None
    • Component/s: wicket
    • Labels:
      None
    • Environment:
      Tomcat 5.5.23
      Windows XP/JDK 1.6.0_03
      Windows 2003/JDK 1.5

      Description

      We have an application that uses AjaxSelfUpdatingTimerBehavior to update a panel that has several child components.
      Application has a performance problem and profiler shows that the most time is consumed in Component.isAuto method.
      It seems that isAuto flag is checked up and down the component tree.

      There is attached a simple demonstration about the problem and screenshots of the profiler displays.

      1. wicket-1671
        16 kB
        Juergen Donnerstag
      2. detach.zip
        69 kB
        Heikki Uotinen

        Activity

        Juergen Donnerstag made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Cannot Reproduce [ 5 ]
        Hide
        Juergen Donnerstag added a comment -

        Please provide more evidence.

        Show
        Juergen Donnerstag added a comment - Please provide more evidence.
        Juergen Donnerstag made changes -
        Attachment wicket-1671 [ 12396815 ]
        Hide
        Juergen Donnerstag added a comment -

        The test case I used for profiling

        Show
        Juergen Donnerstag added a comment - The test case I used for profiling
        Hide
        Juergen Donnerstag added a comment -

        I did some tests against 1.4 trunk. I basically used your source code and created a test case

        public class PerformanceTest extends WicketTestCase
        {
        public void testRenderHomePage() throws Exception
        {
        for (int i = 0; i < 10; i++)
        {
        tester.startPage(PerformanceTestPage.class);
        tester.assertRenderedPage(PerformanceTestPage.class);

        if ((i % 100) == 0)

        { System.out.println(i); }

        }

        System.out.println("fertig");
        }
        }

        Executing that test case and monitoring it with the Yourkit profiler the result is that isAuto() is invoked 2160 times and execution took 157ms. Out of these 2160 isAuto was called 1060 times by detach.

        I've not yet tested it against 1.3 but based on my numbers, any improvement would only be limited.

        Show
        Juergen Donnerstag added a comment - I did some tests against 1.4 trunk. I basically used your source code and created a test case public class PerformanceTest extends WicketTestCase { public void testRenderHomePage() throws Exception { for (int i = 0; i < 10; i++) { tester.startPage(PerformanceTestPage.class); tester.assertRenderedPage(PerformanceTestPage.class); if ((i % 100) == 0) { System.out.println(i); } } System.out.println("fertig"); } } Executing that test case and monitoring it with the Yourkit profiler the result is that isAuto() is invoked 2160 times and execution took 157ms. Out of these 2160 isAuto was called 1060 times by detach. I've not yet tested it against 1.3 but based on my numbers, any improvement would only be limited.
        Hide
        Ari Suutari added a comment -

        Would it be possible for Component.add to propaganate FLAG_AUTO to children if the parent already has it ?
        This way Component.isAuto wouldn't have to check the component tree upwards every time, which would fix this.

        Now, isAuto traverses the component tree up every time it is called (and it is called in detach a lot,
        since it traverses component tree from up to down) and for most of time components don't have FLAG_AUTO
        so this just wastes a lot of time.

        This issue is very visible on pages which have a lot of images, for example, since one page
        render results in browser requesting those images - a lot of requests, a lot of detach calls and
        a lot of isAuto calls - page renders very slowly.

        Show
        Ari Suutari added a comment - Would it be possible for Component.add to propaganate FLAG_AUTO to children if the parent already has it ? This way Component.isAuto wouldn't have to check the component tree upwards every time, which would fix this. Now, isAuto traverses the component tree up every time it is called (and it is called in detach a lot, since it traverses component tree from up to down) and for most of time components don't have FLAG_AUTO so this just wastes a lot of time. This issue is very visible on pages which have a lot of images, for example, since one page render results in browser requesting those images - a lot of requests, a lot of detach calls and a lot of isAuto calls - page renders very slowly.
        Igor Vaynberg made changes -
        Assignee Johan Compagner [ jcompagner ]
        Heikki Uotinen made changes -
        Description Whe have an application that uses AjaxSelfUpdatingTimerBehavior to update a panel that has several child components.
        Application has a performance problem and profiler shows that the most time is consumed in Component.isAuto method.
        It seems that isAuto flag is checked up and down the component tree.

        There is attached a simple demonstration about the problem and screenshots of the profiler displays.
        We have an application that uses AjaxSelfUpdatingTimerBehavior to update a panel that has several child components.
        Application has a performance problem and profiler shows that the most time is consumed in Component.isAuto method.
        It seems that isAuto flag is checked up and down the component tree.

        There is attached a simple demonstration about the problem and screenshots of the profiler displays.
        Heikki Uotinen made changes -
        Field Original Value New Value
        Attachment detach.zip [ 12383015 ]
        Heikki Uotinen created issue -

          People

          • Assignee:
            Johan Compagner
            Reporter:
            Heikki Uotinen
          • Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development