Hi John,
Yes, compile/browse ought to give you good performance. A 200 Person[]
returned over RPC should enable you to resize and show all of them in
a Grid within about 0.5s in web mode (it works in compile/browse too).
Example code below. If it isn't doing so, then something is wrong with
what you are doing I think, not the RPC layer.
regards
gregor
public class SandBox implements EntryPoint {
private VerticalPanel layout = new VerticalPanel();
private ScrollPanel scroller = new ScrollPanel();
private Grid grid = new Grid(1, 5);
private Button fireBtn = new Button("Fire", new ClickListener() {
public void onClick(Widget sender) {
GenericListServiceAsync proxy =
GenericListService.App.getInstance();
proxy.getPeople(new AsyncCallback() {
public void onFailure(Throwable caught) {
Window.alert("RPC call failed");
}
public void onSuccess(Object result) {
Person[] people = (Person[]) result;
loadGrid(people);
}
});
}
});
public void onModuleLoad() {
scroller.setHeight("" + (Window.getClientHeight() - 100));
scroller.setWidth("100%");
scroller.add(grid);
grid.setBorderWidth(4);
grid.setWidth("100%");
layout.add(fireBtn);
layout.add(scroller);
layout.setSize("100%","100%");
RootPanel.get().add(layout);
}
private void loadGrid(Person[] people) {
grid.resize(people.length,5);
for (int i = 0; i < people.length; i++) {
Person p = people[i];
grid.setWidget(i,0,new Label(p.getPersonId()));
grid.setWidget(i,1,new Label(p.getFirstName()));
grid.setWidget(i,2,new Label(p.getLastName()));
grid.setWidget(i,3,new Label(p.getEmail()));
grid.setWidget(i,4,new Label(p.getPhone()));
}
}
}
On Dec 22, 11:57 am, John Lonergan <[email protected]> wrote:
> Thanks Gregor
>
> I've hit the Compile/Browse button - I understood that caused the app
> to run in 'web mode' (as opposed to hosted).
>
> Or do I need to run it in a standalone tomcat to get a perf boost?
>
> John
>
> On Dec 19, 1:48 pm, gregor <[email protected]> wrote:
>
> > Hi John,
>
> > It sounds like you might be testing this in hosted mode. If so, be
> > aware that hosted mode performance, especially where RPC is concerned,
> > bears no relationship whatever to deployed performance. If so, deploy
> > your example and I think you will be amazed at the difference. Note
> > building grids, trees etc involves drawing an order of magnitude more
> > HTML boxes than there are items to display. 200 odd Persons should
> > display < 0.5s when deployed, but go up to 1000+ and you will probably
> > start to notice the browser groaning under the pressure. Then you can
> > either fetch in batches over RPC or (in the say 500-2000 item range)
> > cache all the items on the client and page the grid from that. It
> > obviously varies by situation, but RPC data transfer is one thing and
> > the HTML box drawing is another.
>
> > regards
> > gregor
>
> > On Dec 19, 2:08 am, John Lonergan <[email protected]> wrote:
>
> > > I have been evaluating GWT but have come up against a problem I cannot
> > > solve/understand.
>
> > > I have a little service method that returns a list of 'person data'
>
> > > I am finding that whilst the server side take around zero milli-secs
> > > to handle the query (100-200 rows) the client is taking seconds before
> > > the AsyncCallback.onSuccess() callback fires.
>
> > > I am guessing that GWT is taking an age to deserialise the response.
>
> > > I cannot afford to wait 2 or 3 seconds to deserialise and then render
> > > the response.
>
> > > I am unsure what factors might be influencing the performance. Or
> > > tuning/settings I might look at.
>
> > > I imagine that populating a long grid (well a couple of hundred rows)
> > > is something that must be fairly common and that I am doing something
> > > wrong, or missing a trick.
>
> > > Small sets of 10 rows come back fast enough, but the responsiveness
> > > degrades proportionally to the number of rows returned ....
> > > 12 rows 139ms
> > > 40 rows 719ms
> > > 120 rows 2109ms
>
> > > I like the benefits of being able to use the Java programming model
> > > and toolset - but unless I can solve the perf issues I must look into
> > > alternatives such as generating HTML on the server; ie becoming a more
> > > classic JSP/HTML site and I really don't want to do this if I can
> > > avoid it.
>
> > > Help/advice gratefully accepted.
>
> > > See API below.
>
> > > John
>
> > > My API looks like this..
>
> > > // SERVICE INTERFACE
> > > public interface ContactService extends RemoteService {
> > > public Person[] findContactByName(String namePart);
>
> > > }
>
> > > // TRANSFER OBJECT
> > > public class Person implements IsSerializable {
> > > private static final long serialVersionUID = 1L;
> > > String personId;
> > > String firstName;
> > > String lastName;
> > > String email;
> > > String phone;
>
> > > bunch of Getter/Setters - code omited.
>
> > > }
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---