PDA

View Full Version : grid rendering time inside a window



_sandro_
19 Sep 2008, 9:05 AM
I have modified the file BeanModelGridExample.java in the source code examples, adding the gird to a Window with a button to display it and load the data:


public class NewGrid extends LayoutContainer implements EntryPoint {
protected void onRender(Element parent, int index) {
super.onRender(parent, index);
final Window w = new Window();
w.setLayout(new FitLayout());
w.setCollapsible(true);
w.setSize(600, 400);
final ExampleServiceAsync service = (ExampleServiceAsync)
Registry.get("service");
RpcProxy proxy = new RpcProxy() {
@Override
public void load(Object loadConfig, AsyncCallback callback) {
service.getCustomers(callback);
}
};
BeanModelReader reader = new BeanModelReader();
final ListLoader loader = new BaseListLoader(proxy, reader);
ListStore store = new ListStore<BeanModel>(loader);
w.add(getTable(store));
Button btn = new Button("Show", new SelectionListener<ComponentEvent>() {
@Override
public void componentSelected(ComponentEvent ce) {
w.show();
loader.load();
}
});
add(btn);
}

private Grid getTable(ListStore store) {
List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
columns.add(new ColumnConfig("name", "Name", 100));
columns.add(new ColumnConfig("email", "Email", 100));
columns.add(new ColumnConfig("age", "Age", 100));
columns.add(new ColumnConfig("name", "Name", 100));
columns.add(new ColumnConfig("email", "Email", 100));
columns.add(new ColumnConfig("age", "Age", 100));
ColumnModel cm = new ColumnModel(columns);
Grid<BeanModel> grid = new Grid(store, cm);
grid.setBorders(true);
grid.setLoadMask(true);
grid.getView().setForceFit(true);
return grid;
}

public void onModuleLoad() {
ExampleServiceAsync service=(ExampleServiceAsync)GWT.create(ExampleService.class);
ServiceDefTarget endpoint = (ServiceDefTarget) service;
String moduleRelativeURL = GWT.getModuleBaseURL() + "service";
endpoint.setServiceEntryPoint(moduleRelativeURL);
Registry.register("service", service);
RootPanel.get().add(this);
}
}and replaced the getCustomers() method in the ExampleServiceImpl.java with this lines of code:

public List<Customer> getCustomers() {
List<Customer> customers = new ArrayList();
for (int i=0; i<400; i++) {
Customer customer = new Customer("customer name","e-mail", i);
customers.add(customer);
}
return customers;
}Doing so, the grid seems to be four times slower to display all the 400 rows in web mode (near to 30 seconds on P4 with firefox 2) than in host mode (7-8 sec).
This is the configuration used for this test:
GWT 1.5.2
GXT 1.1
Firefox 2.0.0.12 (firebug turned off)
Linux openSUSE 10.3

gslender
19 Sep 2008, 2:10 PM
have you tried this test on a windows/modern browser platform? what were the results then?

_sandro_
20 Sep 2008, 5:11 AM
Hi.

I done this test in two distinct cases, all of them on localhost:
in the first case, with the embedded GWT browser and the embedded server under Eclipse 3.4 (with cypal studio);
in the second one with Firefox 2 using the compiled version of the application on Tomcat 6.
As result, in the first case the rendering time was 7-8sec; in the second case the rendering time was near to 30sec.
I have used a modern Pentium 4 CPU with 2GB RAM.
Thanks