Sorry - I misread what he was doing.  The downsides I mentioned aren't
applicable.  It might be an interesting approach - it would be interesting
to hear the effect this has on optimization.

On Sat, Oct 31, 2009 at 1:04 PM, Vitali Lovich <[email protected]> wrote:

> I found it worked well to have a wrapper around GWT.create that would
> simply return a on-first-use created singleton.  Thus start-up time is much
> shorter, the cost of creating services in hosted mode is ammortized of the
> usage of the app, and the penalty is only payed the first time you create
> the instance.  The singleton trick below is for the hosted mode - the class
> loader will actually only on first use.  In web-mode, it should all be
> inlined with no overhead.
>
> For example:
>
> public class ServiceFactory {
>  private class MyAmazingServiceAsyncWrapper {
>     static final MyAmazingServiceAsync instance =
> GWT.create(MyAmazingServiceAsync.class)
>  }
>
>  MyAmazingServiceAsync getMyAmazingService() {
>     return MyAmazingServiceAsyncWrapper.instance;
>  }
> }
>
> I wouldn't recommend merging RPC calls into fewer of them just to make
> hosted mode faster.  I think you'll find several problems with that
> approach:
>
> Maintaining the dispatch code on the server, the compiler can't be as
> efficient (I think if you merge a lot of calls together like this, the RPC
> will actually be much more bloated since it won't know the types that can be
> going over the wire).  Also, maintaining the code will be tricky.
>
>
> On Sat, Oct 31, 2009 at 10:14 AM, [email protected] <[email protected]>wrote:
>
>>
>> Googling around, I just found a post from a couple of years ago, which
>> suggested (see "#1 Reduce the number of remote services" at the link
>> below) using a facade for multiple RPC, in order to drive startup time
>> down... has anybody tried this? Does it still make sense?
>>
>>
>> http://robvanmaris.jteam.nl/2007/11/30/optimizing-startup-time-for-gwt-hosted-mode/
>> >>
>>
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to