You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2008/04/09 10:29:27 UTC

[jira] Created: (WICKET-1502) Slow opening of ModalWindow for complex pages

Slow opening of ModalWindow for complex pages
---------------------------------------------

                 Key: WICKET-1502
                 URL: https://issues.apache.org/jira/browse/WICKET-1502
             Project: Wicket
          Issue Type: Improvement
          Components: wicket-extensions
    Affects Versions: 1.3.2
         Environment: Firefox 2
            Reporter: Martin Grigorov
            Priority: Minor


I'm experiencing bad performance when opening a ModalWindow. Profiling it with Firebug I found that the hot spot is modal.js -> disableFocus() ->  disableFocusElement() (which is recursive and iterates over all children of <body>).
I have a (relatively) complex page with a modal window and Firebug profiler shows these results:
disableFocusElement	9823	81.72%	1379.189ms	1379.189ms	0.14ms	0.014ms	768.042ms	modal.js (line 1373)
bind	9	2.9%	48.908ms	49.861ms	5.54ms	0.098ms	45.192ms	modal.js (line 408)
....

As you see there are ~10000 calls to disableFocusElement (i.e. there are ~10000 sub-elements of <body>).

The following patch improves the performance and still remains the functionality:

Index: src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
===================================================================
--- src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js      (revision 646196)
+++ src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js      (working copy)
@@ -1251,9 +1251,9 @@
                this.document = doc;
 
                // disable user interaction
-               this.hideSelectBoxes();
-               this.disableTabs();
-               this.disableFocus();
+               setTimeout(function() {this.hideSelectBoxes()}.bind(this), 300);
+               setTimeout(function() {this.disableTabs()}.bind(this), 400);
+               setTimeout(function() {this.disableFocus()}.bind(this), 1000);
        },


Note: calling "setTimeout(function() {this.disableFocus()}.bind(this), *500*);" didn't help in my case. It needs to be bigger. 
The user experience is good and I don't see any drawbacks of this modification.


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


[jira] Assigned: (WICKET-1502) Slow opening of ModalWindow for complex pages

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1502?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg reassigned WICKET-1502:
-------------------------------------

    Assignee: Matej Knopp

> Slow opening of ModalWindow for complex pages
> ---------------------------------------------
>
>                 Key: WICKET-1502
>                 URL: https://issues.apache.org/jira/browse/WICKET-1502
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-extensions
>    Affects Versions: 1.3.2
>         Environment: Firefox 2
>            Reporter: Martin Grigorov
>            Assignee: Matej Knopp
>            Priority: Minor
>
> I'm experiencing bad performance when opening a ModalWindow. Profiling it with Firebug I found that the hot spot is modal.js -> disableFocus() ->  disableFocusElement() (which is recursive and iterates over all children of <body>).
> I have a (relatively) complex page with a modal window and Firebug profiler shows these results:
> disableFocusElement	9823	81.72%	1379.189ms	1379.189ms	0.14ms	0.014ms	768.042ms	modal.js (line 1373)
> bind	9	2.9%	48.908ms	49.861ms	5.54ms	0.098ms	45.192ms	modal.js (line 408)
> ....
> As you see there are ~10000 calls to disableFocusElement (i.e. there are ~10000 sub-elements of <body>).
> The following patch improves the performance and still remains the functionality:
> Index: src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
> ===================================================================
> --- src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js      (revision 646196)
> +++ src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js      (working copy)
> @@ -1251,9 +1251,9 @@
>                 this.document = doc;
>  
>                 // disable user interaction
> -               this.hideSelectBoxes();
> -               this.disableTabs();
> -               this.disableFocus();
> +               setTimeout(function() {this.hideSelectBoxes()}.bind(this), 300);
> +               setTimeout(function() {this.disableTabs()}.bind(this), 400);
> +               setTimeout(function() {this.disableFocus()}.bind(this), 1000);
>         },
> Note: calling "setTimeout(function() {this.disableFocus()}.bind(this), *500*);" didn't help in my case. It needs to be bigger. 
> The user experience is good and I don't see any drawbacks of this modification.

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


[jira] Resolved: (WICKET-1502) Slow opening of ModalWindow for complex pages

Posted by "Matej Knopp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1502?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matej Knopp resolved WICKET-1502.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 1.3.5

> Slow opening of ModalWindow for complex pages
> ---------------------------------------------
>
>                 Key: WICKET-1502
>                 URL: https://issues.apache.org/jira/browse/WICKET-1502
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-extensions
>    Affects Versions: 1.3.2
>         Environment: Firefox 2
>            Reporter: Martin Grigorov
>            Assignee: Matej Knopp
>            Priority: Minor
>             Fix For: 1.3.5
>
>
> I'm experiencing bad performance when opening a ModalWindow. Profiling it with Firebug I found that the hot spot is modal.js -> disableFocus() ->  disableFocusElement() (which is recursive and iterates over all children of <body>).
> I have a (relatively) complex page with a modal window and Firebug profiler shows these results:
> disableFocusElement	9823	81.72%	1379.189ms	1379.189ms	0.14ms	0.014ms	768.042ms	modal.js (line 1373)
> bind	9	2.9%	48.908ms	49.861ms	5.54ms	0.098ms	45.192ms	modal.js (line 408)
> ....
> As you see there are ~10000 calls to disableFocusElement (i.e. there are ~10000 sub-elements of <body>).
> The following patch improves the performance and still remains the functionality:
> Index: src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
> ===================================================================
> --- src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js      (revision 646196)
> +++ src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js      (working copy)
> @@ -1251,9 +1251,9 @@
>                 this.document = doc;
>  
>                 // disable user interaction
> -               this.hideSelectBoxes();
> -               this.disableTabs();
> -               this.disableFocus();
> +               setTimeout(function() {this.hideSelectBoxes()}.bind(this), 300);
> +               setTimeout(function() {this.disableTabs()}.bind(this), 400);
> +               setTimeout(function() {this.disableFocus()}.bind(this), 1000);
>         },
> Note: calling "setTimeout(function() {this.disableFocus()}.bind(this), *500*);" didn't help in my case. It needs to be bigger. 
> The user experience is good and I don't see any drawbacks of this modification.

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