Hi, thanks for the response.
As I said I expect a higher CPU usage, but not in that extend. When I am doing the same with the Grid of GXT, it "only" consumes 20% of CPU usage in IE. Apparently CellTable was not build for this purpose, I'll have to find another solution. The requirement is 4 times a second, nothing I can change about it. Thanks anyways Cheers T On 20 Jan., 16:17, John LaBanca <[email protected]> wrote: > You're refreshing 4x a second, what do you expect to happen? > > CellTable constructs a giant HTML string, which requires a lot of string > manipulation and logical code that could take up the CPU. Since javascript > is single threaded, the browser will be unresponsive while CellTable renders > the code, so it makes sense for it to peg the CPU (I'm guessing you have a > dual code system?) and get it over with as quickly as possible. If it > didn't peg the CPU, it would just take longer but still block user input. > > Happy as I am that you can update 4x a second, that generally isn't a good > idea because it makes the app unresponsive and harder to use. > > Thanks, > John LaBanca > [email protected] > > > > On Thu, Jan 20, 2011 at 6:28 AM, remuera <[email protected]> wrote: > > Hi, > > > in my web app I have to refresh a table of 6 columns and around 50 > > rows to refresh 4 times a second with new data. I'm using CellTable > > for that, since its performance is good, but when I do that, CPU usage > > is at about 60%! > > > I know that rendering of the HTMl in the browser is expensive, but > > that expensive? Is there any way how I can display the data using > > CellTable? Any other idea? > > > Here is my test code: > > > public class Sandbox implements EntryPoint > > { > > public CellTable<Contact> table = null; > > public ArrayList<Contact> list = new ArrayList<Contact>(); > > > public void onModuleLoad() > > { > > > // Create a CellTable. > > table = new CellTable<Contact>(); > > > table.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED); > > > TextColumn<Contact> nameColumn = new TextColumn<Contact>() { > > @Override > > public String getValue(Contact object) > > { > > return object.name; > > } > > }; > > table.addColumn(nameColumn, "Name"); > > > TextColumn<Contact> aColumn = new TextColumn<Contact>() { > > @Override > > public String getValue(Contact object) > > { > > return object.a + ""; > > } > > }; > > table.addColumn(aColumn, "A"); > > > TextColumn<Contact> bColumn = new TextColumn<Contact>() { > > @Override > > public String getValue(Contact object) > > { > > return object.b + ""; > > } > > }; > > table.addColumn(bColumn, "B"); > > > TextColumn<Contact> cColumn = new TextColumn<Contact>() { > > @Override > > public String getValue(Contact object) > > { > > return object.c + ""; > > } > > }; > > table.addColumn(cColumn, "C"); > > > TextColumn<Contact> dColumn = new TextColumn<Contact>() { > > @Override > > public String getValue(Contact object) > > { > > return object.d + ""; > > } > > }; > > table.addColumn(dColumn, "D"); > > > RootPanel.get().add(table); > > > Timer timer = new Timer() > > { > > public void run() > > { > > update(); > > }}; > > timer.scheduleRepeating(250); > > > } > > > private void update() > > { > > list.clear(); > > for(int i = 0; i < 50; i++) > > { > > list.add(new Contact("abc", Random.nextDouble(), > > Random.nextDouble(), Random.nextDouble(), Random.nextDouble())); > > > } > > table.setRowCount(list.size(), true); > > > table.setRowData(list); > > } > > } > > > class Contact > > { > > public final String name; > > public final double a; > > public final double b; > > public final double c; > > public final double d; > > > public Contact(String name, double a, double b, double c, double d) > > { > > this.name = name; > > this.a = a; > > this.b = b; > > this.c = c; > > this.d = d; > > } > > } > > > Thanks for any help on that. > > > Cheers > > > T > > > -- > > You received this message because you are subscribed to the Google Groups > > "Google Web Toolkit" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]<google-web-toolkit%2Bunsubs > > [email protected]> > > . > > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
