11 Replies Latest reply on Jan 21, 2008 2:08 AM by Flax Seed

    ajax call slow on internet explorer fast on firefox

    Tathagat Tathagat Newbie

      Hi All.
      I am calling the following code.

      <a4j:commandLink reRender="id">
      <t:updateActionListener property="#{form.prop} value=""true"/>
      </a4j:commandLink>
      


      Takes ages (approx 20 seconds and more) on IE and less than 2 seconds (sometimes less than 1) on firefox.

      When I click on IE, the page freezes, and then something happens very slowly. Most of the work is being done on the client side. It's obvious IE is doing something. But what? Any help is appreciated.

      Another thing - speed on IE depends on how big the page is (datawise). On a page with just some fields, speed is good. But on a page with lots of data - it's slow.

      Thanks.

        • 1. Re: ajax call slow on internet explorer fast on firefox
          Ilya Shaikovsky Master

          Seems like we need more info. Describe your environment. and if this possible provide pages where you think RF causes such effects.

          • 2. Re: ajax call slow on internet explorer fast on firefox
            Tathagat Tathagat Newbie

            Windows XP
            Java 1.5.0_04-b05
            richfaces-ui-3.1.2.GA
            myfaces-api-1.1.5

            Here is a sample code where I can reproduce the time difference between IE 6 and firefox (2.0.0.11) use.

            TestAction

            package com.dresdnerkb.gm.appdev.test;
            
            import org.apache.log4j.Logger;
            
            public class TestAction {
             private static Logger logger = Logger.getLogger(TestAction.class.getName());
             private TestForm testForm = new TestForm();
            
             public String setParameterValue () {
             logger.debug("#############################setParameterValue#############################");
             testForm.getTestBean().setOutput(testForm.getTestBean().getInput());
            
             return null;
             }
            
             public TestForm getTestForm() {
             return testForm;
             }
            
             public void setTestForm(TestForm testForm) {
             this.testForm = testForm;
             }
            }
            


            TestForm
            package com.dresdnerkb.gm.appdev.test;
            
            public class TestForm {
             private TestBean testBean;
            
             public TestBean getTestBean() {
             return testBean;
             }
            
             public void setTestBean(TestBean testBean) {
             this.testBean = testBean;
             }
            
             public TestForm () {
             testBean = new TestBean();
             }
            }
            


            TestBean
            package com.dresdnerkb.gm.appdev.test;
            
            import java.util.Vector;
            
            public class TestBean {
             private String input;
             private String output;
             private Vector dataVector;
            
             public Vector getDataVector() {
             return dataVector;
             }
             public void setDataVector(Vector dataVector) {
             this.dataVector = dataVector;
             }
             public String getInput() {
             return input;
             }
             public void setInput(String message) {
             this.input = message;
             }
             public String getOutput() {
             return output;
             }
             public void setOutput(String output) {
             this.output = output;
             }
            
             public TestBean () {
             dataVector = new Vector();
             for (int i=0; i<10000; i++) {
             dataVector.add(new Integer(i));
             }
             }
            }
            


            test.xhtml
            <html xmlns="http://www.w3.org/1999/xhtml"
             xmlns:ui="http://java.sun.com/jsf/facelets"
             xmlns:t="http://myfaces.apache.org/tomahawk"
             xmlns:h="http://java.sun.com/jsf/html"
             xmlns:f="http://java.sun.com/jsf/core"
             xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
             xmlns:rich="http://richfaces.ajax4jsf.org/rich">
            
             <body>
             <rich:modalPanel id="ajaxLoadingModalBox" minHeight="200" minWidth="450"
             height="100" width="250" zindex="2000">
             <f:facet name="header">
             <h:outputText value="Request being processed"/>
             </f:facet>
             Your request is being processed, please wait.
             </rich:modalPanel>
            
             <a4j:status onstart="Richfaces.showModalPanel('ajaxLoadingModalBox',{width:450, top:200})" onstop="Richfaces.hideModalPanel('ajaxLoadingModalBox')"/>
            
             <h:form>
             <t:outputText value="#{testForm.testBean.output}" id="output" forceId="true"/>
             <t:inputText value="#{testForm.testBean.input}" id="input" forceId="true">
             <a4j:support event="onchange" reRender="output" action="#{testAction.setParameterValue}"/>
             </t:inputText>
            
             <br/><br/>
            
             <t:dataList value="#{testForm.testBean.dataVector}" var="data">
             <t:inputText value="#{data}"/>
             </t:dataList>
            
             </h:form>
            
            
             <a4j:log/>
             </body>
            
            </html>
            


            If 10000 is too much in TestBean, change it to 1000.. time difference is still visible.

            Thanks!

            • 3. Re: ajax call slow on internet explorer fast on firefox
              Steve Whatmore Newbie

              Although we haven't gone to the lengths that you have we are also seeing a similar noticeable difference in performance between IE and Firefox (with of course FireFox being much faster).

              This needs to be predicated by the fact that we have not yet gone through a performance / optimization stage in our project, but the results stand nonetheless.

              Whatty

              • 4. Re: ajax call slow on internet explorer fast on firefox
                Mikael Andersson Master

                Hi all,
                any progress on figuring out why IE is so slow?

                Really interested in this since we might start using richfaces (switching web framework) and have some pretty big pages to be displayed (and IE is the browser we must support).

                If not, do you have any advice on how to profile/debug this IE phenomenon? (are there more debug info which can be enabled, profiling tools, etc.).

                Many thanks,
                Mike

                • 5. Re: ajax call slow on internet explorer fast on firefox
                  Tathagat Tathagat Newbie

                  Update....

                  If I remove the modal window showing part from the code, IE becomes much faster. Looks like rich modal window is slowing down things.

                  Any idea why?

                  New question relating to the above - my requirement is that users should not be allowed to play with the system while one ajax request is in play. That is why I use modal window to block them. Are there other alternatives?

                  Thanks and Regards
                  Tathagat

                  • 6. Re: ajax call slow on internet explorer fast on firefox
                    Tathagat Tathagat Newbie

                    It states on http://livedemo.exadel.com/richfaces-demo/richfaces/modalPanel.jsf?c=modalPanel
                    that dialog is moved to the top of the browser DOM just after it is rendered.

                    Could this be the cause of it being slow in IE? DOM modifications are really time consuming in IE.

                    How can we prevent this?

                    Thanks and Regards
                    Tathagat

                    • 7. Re: ajax call slow on internet explorer fast on firefox
                      Sergey Smirnov Master

                       

                      "mail@tathagat.com" wrote:

                      Could this be the cause of it being slow in IE? DOM modifications are really time consuming in IE.

                      No, it could not.

                      • 8. Re: ajax call slow on internet explorer fast on firefox
                        Tathagat Tathagat Newbie

                        I moved from using rich modalPanel to a java script based modal window.
                        Now things are much much faster.

                        So I still think it was the modalPanel that was the cause of everything being so slow in IE (of course in pages where modalPanel was being used/shown).

                        Here are some modal window options.
                        http://javathehutt.blogspot.com/2006/07/rails-realities-part-15-ajax-modal.html

                        Regards
                        Tathagat

                        • 9. Re: ajax call slow on internet explorer fast on firefox
                          Viggo Navarsete Expert

                          I've also experienced that IE is much slower than Firefox. We're using one Tree and some Panels on our page, and it's significantly slower on IE. We haven't done much testing yet why it's so different in those browsers, but it seemed to be fast in Opera as well!

                          • 10. Re: ajax call slow on internet explorer fast on firefox
                            Florian Marwede Expert

                             

                            my requirement is that users should not be allowed to play with the system while one ajax request is in play. That is why I use modal window to block them.


                            We are doing this, too. For this reason I'm also very interested in this topic.

                            • 11. Re: ajax call slow on internet explorer fast on firefox
                              Flax Seed Newbie

                              Worse still is performance drops way off in 3.1.3!! We upgraded our jars from 3.1.2 and see significant degradation. We've since moved back.