Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ListGrid scrolling is very very slow

    SmartGWT version 3.0
    GWT version 2.4.0
    OS = Ubuntu11.10 (not tried other OS's bcoz I only have this)
    Browser = firefox 7.0.1

    Problem description:

    I am creating a SGWT RPC application having a UI dialog which has a ListGrid object (among other things). I could successfuly do RPC, fetch and load the data to list grid object. But when I start scrolling it is pathetically slow.

    To isolate the problem, I created a bare-bones application with no RPC stuff, but just one single ListGrid with locally populated data (with 100 ListGridRecords). This still has the same behavior.

    Am I missing something here? The code is given below:

    Code:
    import java.util.ArrayList;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    import com.smartgwt.client.widgets.grid.ListGridRecord;
    
    /**
     * Entry point classes define <code>onModuleLoad()</code>.
     */
    public class RemoteFileBrowser implements EntryPoint {
    
    	/**
    	 * This is the entry point method.
    	 */
    	public void onModuleLoad() {
    		ListGrid grid = getListView();
    		updateListView(grid);
    		grid.draw();
    	}
    	
    	private ListGrid getListView() {
    		ListGrid fileGrid = new ListGrid();
    		fileGrid.setWidth(500);
    		fileGrid.setHeight(400);
    		fileGrid.setLeft(100);
    		fileGrid.setTop(100);
    		ListGridField nameField = new ListGridField("name");
    		ListGridField sizeField = new ListGridField("size");
    		ListGridField changedField = new ListGridField("changed");
    		ListGridField rightsField = new ListGridField("rights");
    		ListGridField ownerField = new ListGridField("owner");
    		
    		fileGrid.setFields(nameField, sizeField, ownerField, rightsField, changedField);
    		
    		return fileGrid;
    	}
    	
    	private void updateListView(ListGrid grid) {
    		
    		// create a RecordList object containing ListGridRecord items
    		// and associate with the view.
    		//RecordList list = new RecordList();
    		ArrayList<ListGridRecord> list = new ArrayList<ListGridRecord>();
    		for (int i=0; i<100; ++i) {
    			ListGridRecord record = new ListGridRecord();
    			record.setAttribute("name", "name" + i);
    			record.setAttribute("size", "size" + i);
    			record.setAttribute("changed", "changed" + i);
    			record.setAttribute("rights", "rights"+i);
    			record.setAttribute("owner", "owner" + i);
    
    			list.add(record);
    
    		}
    		//grid.setData(list);
    		ListGridRecord[] records = new ListGridRecord[list.size()];
    		list.toArray(records);
    		grid.setData(records);
    
    		}
    
    }
    After running the above code the list grid displays with 100 records. However, the scrolling is painfully slow and unacceptable. Please help.

    regards,
    RV

    #2
    No one else is seeing this (even in hosted mode). Could be something wrong with your machine, such as bad/slow video drivers or Gnome misconfiguration.

    Comment


      #3
      i had an application more than 150 records and it works perfect try to change the pc

      Comment


        #4
        I tried in one more machine with the following configuration:

        memory: 16GB
        OS: Ubuntu 11.10 - 64 bit
        CPU: 6 core AMD processor
        Mode: Dev mode
        Browser: firefox 7.0.1

        Result: Same as previous.

        Meanwhile, I did some more searching, after which I added the below line:
        Code:
            fileGrid.setFields(nameField, sizeField, ownerField, rightsField, changedField);
            fileGrid.setShowAllRecords(true); // newly added line.
            return fileGrid;
        After this, it started behaving well. I don't know if this is the correct fix, becoz for a large dataset, we generally don't want to set this to true.

        I shall try on a windows Browser and in web server hosted mode to see the difference.
        regards,
        RV

        Comment


          #5
          This is in the FAQ.

          Next time, don't post code saying it's slow while keeping the real settings a secret. This wastes your time, and ours.

          Comment


            #6
            Sorry? I didn't hide anything, which I already knew. I was looking for that piece of line like setShowAllRecords(boolean). While it is true that I wasted a lot of time to get this simple answer, which shows how difficult it is, to get simple things working.

            In fact, before posting this question, I looked up for all possible help, by "searching" in smartclient forums, but could not really get the info, that I was looking for. Just for your confirmation, I looked up to FAQ, to see if this issue was really documented. I searched for various permutation n combination of keywords like listgrid, slow, setShowAllRecords, but could not find what I was looking for.

            Will be enlightened to know from you, which part of the FAQ had this.
            Last edited by rv_nath; 24 Apr 2012, 22:23.

            Comment


              #7
              We'll assume this is an attempt at humor..

              Your original code posting did not contain this line. Therefore no one could tell you that this was the problem because you did not post it. So anyone analyzing your code (both community and Isomorphic) was wasting their time.

              So please try not to do this in the future - don't post code claiming a problem that the code will not reproduce.

              Comment


                #8
                Also just for completeness: the documentation for this method tells you it has performance consequences and links to several other methods to give you a complete picture, and give you various tuning options.

                Comment


                  #9
                  Originally posted by Isomorphic
                  We'll assume this is an attempt at humor..

                  Your original code posting did not contain this line. Therefore no one could tell you that this was the problem because you did not post it. So anyone analyzing your code (both community and Isomorphic) was wasting their time.

                  So please try not to do this in the future - don't post code claiming a problem that the code will not reproduce.
                  Dear Admin,

                  #1.
                  I think that the humour is coming from your end. If you run the piece of code that I posted, there is all probability that you will be able to produce the problem. it seems you are just comming in the air, without checking.

                  #2. And then in the subsequent reply, I posted that adding that missing line solved that problem. This piece of line, I found after much struggle.

                  Any serious person running my code, should have reproduced the problem.

                  Comment


                    #10
                    No, once again the code you posted does not reproduce a problem.

                    Comment


                      #11
                      It is strange. This code does definitely reproduce the problem. It is semantically no different from what is earlier posted.


                      Code:
                      package com.comviva.remotefilebrowser.client;
                      
                      
                      import java.util.ArrayList;
                      
                      import com.google.gwt.core.client.EntryPoint;
                      import com.smartgwt.client.widgets.Canvas;
                      import com.smartgwt.client.widgets.grid.ListGrid;
                      import com.smartgwt.client.widgets.grid.ListGridField;
                      import com.smartgwt.client.widgets.grid.ListGridRecord;
                      
                      
                      /**
                       * Entry point classes define <code>onModuleLoad()</code>.
                       */
                      public class RemoteFileBrowser implements EntryPoint {
                      
                      	/**
                      	 * This is the entry point method.
                      	 */
                      	public void onModuleLoad() {
                      //		RemoteFileDialog rfDialog = new RemoteFileDialog("*.*, *.htm, *.cpp, *.hpp");
                      //		rfDialog.show();
                      		
                      		Canvas canvas = new Canvas();
                      		ListGrid grid = getListView();
                      		updateListView(grid);
                      		canvas.addChild(grid);
                      		canvas.draw();
                      		
                      	}
                      	
                      	private ListGrid getListView() {
                      		ListGrid fileGrid = new ListGrid();
                      		fileGrid.setWidth(500);
                      		fileGrid.setHeight(400);
                      		fileGrid.setLeft(100);
                      		fileGrid.setTop(100);
                      		ListGridField nameField = new ListGridField("name");
                      		ListGridField sizeField = new ListGridField("size");
                      		ListGridField changedField = new ListGridField("changed");
                      		ListGridField rightsField = new ListGridField("rights");
                      		ListGridField ownerField = new ListGridField("owner");
                      		
                      		fileGrid.setFields(nameField, sizeField, ownerField, rightsField, changedField);
                      //		fileGrid.setShowAllRecords(true);
                      		return fileGrid;
                      	}
                      	
                      	private void updateListView(ListGrid grid) {
                      		
                      		// create a RecordList object containing ListGridRecord items
                      		// and associate with the view.
                      		//RecordList list = new RecordList();
                      		ArrayList<ListGridRecord> list = new ArrayList<ListGridRecord>();
                      		for (int i=0; i<100; ++i) {
                      			ListGridRecord record = new ListGridRecord();
                      			record.setAttribute("name", "name" + i);
                      			record.setAttribute("size", "size" + i);
                      			record.setAttribute("changed", "changed" + i);
                      			record.setAttribute("rights", "rights"+i);
                      			record.setAttribute("owner", "owner" + i);
                      
                      			list.add(record);
                      
                      		}
                      		//grid.setData(list);
                      		ListGridRecord[] records = new ListGridRecord[list.size()];
                      		list.toArray(records);
                      		grid.setData(records);
                      
                      
                      		}
                      
                      }
                      Before posting here now, I have also checked this on a windowsXP PC (in dev mode), using IE.

                      Since, I am not using grid.setShowAllRecords(true) as I didn't know this, the problem is definitely reproducible 100%. All you need to do is to paste it into a new SGWT sample, eliminate a few compile errors (due to any package name errors) and run it.

                      In the UI, once the grid is displayed, try scrolling the list vigorously [or slowly, it really doesn't matter] in both up and down directions, or in one single direction 2 to 3 times. You would notice that the display freezes and gives significantly noticeable slowness in updating the view.

                      Note that I have also tested this using a latest Chrome browser that I downloaded today, which also shows similar behavior.

                      I had also posted this question on stackoverflow here: http://stackoverflow.com/questions/10303179/smartgwt-listgrid-very-slow-while-scrolling

                      If, I were making humour, I would not have taken pains to post in multiple forums. After lot of searching and scratching the head, I found a solution about setShowallRecords. Later I posted the solution in a subsequent reply, so it might help others who are stuck like me.

                      Comment


                        #12
                        Just one last time - this doesn't reproduce a problem, and no one should be using the setting you recommend.

                        Oh, wait a minute - are you testing performance *in hosted mode*?

                        Comment


                          #13
                          I am running in development mode in the sense that I have not created a .war file and deployed it to an application server. I use eclipse to "run" the application, and then use firefox to connect to the running instance.
                          Last edited by rv_nath; 26 Apr 2012, 08:41.

                          Comment


                            #14
                            Does the URL in the browser have the parameter "gwt.codesvr=127.0.0.1"? If so, you're running in development mode and you need to compile the application and run it in web mode.

                            Comment


                              #15
                              Thanks for this. Yes, I was checking in development mode, so it was very slow. When I create a .war file and deploy it in tomcat container, it works decently. I didn't imagine that it made so much of difference in dev mode compared to web server hosted mode.

                              Treating this issue as closed.

                              Comment

                              Working...
                              X