Code Split / Prefetching Mechanics

25 views
Skip to first unread message

Watnuss

unread,
Dec 6, 2011, 5:03:51 AM12/6/11
to Google Web Toolkit
Hi,

I am wondering how the prefetching described in
http://code.google.com/intl/de-DE/webtoolkit/doc/latest/DevGuideCodeSplitting.html
works exactly.

Will the code always be loaded when a runAsync call is performed or
just the 1st time the method is invoked?

In my opinion it makes only sense if the code is just loaded once.
Otherwise I don't really see a benefit in using the code split/
prefetching.

If it is just loaded only once. How much is the overhead in calling
the runAsync method (when the code is already loaded)?

Thanks for your help
Regards

Watnuss

Ed

unread,
Dec 6, 2011, 12:48:17 PM12/6/11
to Google Web Toolkit
Good question, but if you only use it once, you don't need to worry
about it.
I would only use it once such that you aren't dependent on the
implementation details as you never know how it will be in the future.
I use it a bit like in the example of the link you specify.
I check if the instance is initialized. If not, you initialize it in a
runAsync, which is then only called once.
- Ed

On Dec 6, 11:03 am, Watnuss <tonk...@gmail.com> wrote:
> Hi,
>

> I am wondering how the prefetching described inhttp://code.google.com/intl/de-DE/webtoolkit/doc/latest/DevGuideCodeS...

Jens

unread,
Dec 6, 2011, 5:17:28 PM12/6/11
to google-we...@googlegroups.com
The code will only be loaded once and if its already available you wont recognize any delay in code execution. So I think there is little to no overhead when reaching a code split point more than once. At least I havent seen any issues in my apps (about 20 split points, which are executed multiple times based on navigation inside the app). They just work like expected.

-- J

Watnuss

unread,
Dec 7, 2011, 3:20:07 AM12/7/11
to Google Web Toolkit
Okay. Thanks for sharing your experience.=)

I think I will just use the prefetching and see how the application is
behaving compared to the application without code splitting and choose
then.

Reply all
Reply to author
Forward
0 new messages