Wednesday, July 4, 2012

Re: What is the minimum Internet speed connexion that the GWT team is considering when testing their GWT application ?

#1
I have not used "inline CSS", I mean, I did not put any css code in my ui binder files. I just use 3 stylesheets (admin.css, common.css, normal.css) that are declarated in the client bundle. 
- Will "inline css" reduce the code to download ?

If you use ClientBundle with CssResource your CSS code is already inlined into your app. Inlining itself does not reduce the download size,  but if you use ClientBundle + CssResource GWT will minify your CSS. That means it removes unused CSS classes, converts your possibly long CSS classnames into shorter ones, merges CSS classes and rules where it makes sense and removes all white spaces. So I would say you can't make it any smaller. The only thing you can do is to tell GWT to shorten your class names even more.

 
- How could I do to not download the admin.css at startup but just when the user go to the admin ?

You have to create a separate ClientBundle/CssResource that you only use inside your admin area. Then you use GWT's code splitting and you split out your admin area. If done correctly your app will start/load without any code from your admin area and once you click on admin and you pass your code split point GWT will load the admin code (which includes the admin ClientBundle).


#2  
Actually I am thinking that : "all images declarated as ImageResource or DataResources inside a ClientBundle will be download  at startup time." Is it true ?

Not 100%. For IE6 and IE7 GWT will create a combined image that contains your small images. That means if you have 4 icons with 16x16 pixel size then GWT will create a single 32x32 pixel image that contains these 4 icons and GWT stores information about where to find these 4 icons in that combined image into your app. Obviously this won't work for animated gif's. This does not reduce the download size of the images itself, but it saves some network overhead (less server requests). These combined images won't be loaded at startup time, they will be loaded when you need them.

For other browsers GWT only inlines Images if they are not too large. If you disable image inlining globally then GWT will use combined images for every browser.

 
#3
As Joseph tolds me, the server should  compress the content (RPC + images) ?
 - Could I do that with YUI Compressor ?
 - I heard about a tool to compress images
 (Webp - https://developers.google.com/speed/webp/index )...Should I use a combination of YUI Compressor AND Webp ?
 - How to compress RPC ?

As Joseph already said, the best compression you can get is to configure your web server to use gzip compression. And if you don't want your web server to compress your resources on the fly then you could also use GWTs Precompress linker (http://code.google.com/p/google-web-toolkit/wiki/PrecompressLinker) that will generated gzipped files for you. Most web servers can be configured to serve these gzipped files.

 
#4
Finally there is so much tools that I do not what should be the code optimization workflow ?

First I would think about GWTs split points. They can really save you a lot of startup time. For example we have a 3 MB permutation but only have to download ~800kb at the start of the app because of split points. In combination with gzip compression on the web server these ~800kb will become ~300kb that a user has to download...thats 10% of the permutation size. The rest of the code will be loaded when needed. So these two points will save you the most!

And of course it helps if:
- you can reduce the amount of different GWT widgets used in your app
- simplify the DOM if possible
- you don't have duplicate/similar code lying around (try Googles CodePro Analytix for Eclipse to find similar code and refactor it)
BUT these optimizations are really time consuming and won't give you such a great benefit in terms of size reduction. So I would not give them a high priority (well ok, except duplicate/similar code refactor ;-)).

-- J.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/jif07bkqpKcJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment