Bad ModalPanel performance (RF-3670)
leiras Sep 11, 2008 4:35 PMHi all,
i'm having performance problem with ModalPanel on my application, so i made a simple project to test its performance "isolatedly" (sorry about my english).
Then i noted that the time to open and close the modal increases according the number of rendered components in my page. Here is my relevant test code:
<body> <rich:modalPanel id="mpDefault" resizeable="false" autosized="true"> <h:form id="formModalPanel"> <a4j:outputPanel id="opModalPanel" ajaxRendered="true"> <rich:panel id="pnModalPanel" binding="#{testModalPanel.pnModalPanel}" /> </a4j:outputPanel> </h:form> </rich:modalPanel> <h:form id="startForm"> <a4j:commandButton value="show modal" oncomplete="Richfaces.showModalPanel('mpDefault');" /> <rich:panel id="pnPanel" binding="#{testPanel.pnPanel}" /> </h:form>
public class TestModalPanel { private HtmlPanel pnModalPanel; public TestModalPanel() { pnModalPanel = new HtmlPanel(); pnModalPanel.setStyle("background-color: blue; height: 200px; width: 200px; text-align: center;"); HtmlAjaxCommandButton btClose = new HtmlAjaxCommandButton(); btClose.setValue("fechar"); btClose.setOncomplete("Richfaces.hideModalPanel('mpDefault');"); pnModalPanel.getChildren().add(btClose); } public HtmlPanel getPnModalPanel() { return pnModalPanel; } public void setPnModalPanel(HtmlPanel pnModalPanel) { this.pnModalPanel = pnModalPanel; } }
public class TestPanel { private HtmlPanel pnPanel; public TestPanel() { this.pnPanel = new HtmlPanel(); this.pnPanel.setStyle("height: 400px; width: 800px; margin-left: auto; margin-right: auto; background-color: yellow; overflow: auto;"); HtmlPanel pn = null; HtmlOutputText ot = null; HtmlInputTextarea ta = null; HtmlInputText it = null; for (int i=0, iLen=1000; i<iLen; i++) { pn = new HtmlPanel(); pn.setId("pn"+i); pn.setStyle("width: 100%; height: 100px;"); ot = new HtmlOutputText(); ot.setId("ot"+i); ot.setValue("HtmlOutputText ["+i+"]"); pn.getChildren().add(ot); ta = new HtmlInputTextarea(); ta.setId("ta"+i); pn.getChildren().add(ta); it = new HtmlInputText(); it.setId("it"+i); pn.getChildren().add(it); this.pnPanel.getChildren().add(pn); } } public HtmlPanel getPnPanel() { return pnPanel; } public void setPnPanel(HtmlPanel pnPanel) { this.pnPanel = pnPanel; } }
With the iLen=1000, the Modal takes around 8s to open and 4s to close. If i set iLen=1, the Modal takes less than 1s to open or close.
I found some posts with same problem, and some reported bugs too.
http://jira.jboss.com/jira/browse/RF-3670
http://jira.jboss.com/jira/browse/RF-3572
Is this a bug? Am i doing something wrong? Any tip to increase the performance?
My setup:
Apache Tomcat/6.0.14
rf3.2.2 GA
IE 7 and FF2.0
Thanks a lot.