Wednesday, November 3, 2010

Re: My CellTable is slow and I don't know why

Have you tried looking at it with SpeedTracer?  We tested with large tables (100 rows), and the hover code is pretty straight forward.

In past applications, we've seen performance problems when hovering due to descendant style selectors because of the way they are implemented in browser.

For example, you have this CSS style defined:
.myRandomWidget td {
  padding: 3px;
}

And you have a CellTable that is NOT myRandomWidget, then changing the hover style of the row will cause some browsers to walk up from every TD in the CellTable trying to match the style definition.  In the degenerate case, where CellTable is not myRandomWidget, this means walking up to the body element.  This is a native browser implementation, and the only solution is to avoid descendant style selectors.

If this isn't the case, SpeedTracer should be able to help you narrow down the performance problem.

Thanks,
John LaBanca
jlabanca@google.com


On Wed, Nov 3, 2010 at 10:22 AM, Owen Powell <opowell@gmail.com> wrote:
I've only tested it on the latest stable build of Chrome.

On 3 nov, 14:28, Lukas Herman <herni...@gmail.com> wrote:
> My CellTable is slow under Firefox 3.6 only.
>
> On 3 lis, 14:07, Owen Powell <opow...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hi everyone,
>
> > When I make a simple CellTable, the responsiveness of the table in the
> > browser to mouse events (mouseOver, mouseOut) is nowhere nearly as
> > fast as the table in the Showcase (http://gwt.google.com/samples/
> > Showcase/Showcase.html#!CwCellTable). Any ideas why this might be?
>
> > My code is below. Best,
>
> > ~Owen
>
> > // Data object class.
>
> > package tabletest.client;
>
> > import java.util.ArrayList;
>
> > public class InterestingThing {
>
> >         public ArrayList<String> values = new ArrayList<String>();
>
> >         public InterestingThing(int n) {
> >                 for (int i=0; i<n; i++) {
> >                         values.add("Value " + i);
> >                 }
> >         }
>
> > }
>
> > // Custom CellTable class.
>
> > package tabletest.client;
>
> > import java.util.ArrayList;
>
> > import com.google.gwt.user.cellview.client.CellTable;
> > import com.google.gwt.user.cellview.client.TextColumn;
>
> > public class MyCellTable extends CellTable<InterestingThing> {
>
> >         public MyCellTable() {
> >                 super();
>
> >                 int NUM_COLUMNS = 4;
> >                 int NUM_ROWS = 25;
>
> >                 // Create table.
> >                 for (int i=0; i<NUM_COLUMNS; i++) {
> >                         addTextColumn(i);
> >                 }
>
> >                 // Create data.
> >                 ArrayList<InterestingThing> data = new
> > ArrayList<InterestingThing>();
> >                 for (int i=0; i<NUM_ROWS; i++) {
> >                         data.add(new InterestingThing(NUM_COLUMNS));
> >                 }
>
> >                 // Put data into table.
> >                 setRowData(0, data);
> >         }
>
> >         private void addTextColumn(final int i) {
> >                 TextColumn<InterestingThing> newColumn = new
> > TextColumn<InterestingThing>() {
>
> >                         public String getValue(InterestingThing m) {
> >                                 return m.values.get(i);
> >                         }
> >                 };
> >                 addColumn(newColumn, "Field " + i);
> >         }
>
> > }
>
> > // Entrypoint.
>
> > package tabletest.client;
>
> > import com.google.gwt.core.client.EntryPoint;
> > import com.google.gwt.user.client.ui.RootPanel;
>
> > public class TableTest implements EntryPoint {
>
> >         public void onModuleLoad() {
>
> >                 MyCellTable table = new MyCellTable();
> >                 RootPanel.get().add(table);
> >         }
>
> > }

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment