First, let me start by saying that people are already writing javascript libraries using GWT and have been for some time. Ray Cromwell created the GWT exporter library for this exact purpose for his own usage and open sourced it. While bootloaders seem expensive it is the only way to deliver the most efficient code to the client. There is no possible way for code size to grow when compiled because if you go far enough every method will eventually make it to a JSNI method, so what you are missing in your calculations is all the code supplied by google and the small overhead code involved with the bootloader. However, there is a linker available to create only one output, but in order for this to work the compilation must result in only one permutation, which is almost impossible unless you know the browser your client will be using. You asked: "Is there a way to crop out all the unnecessary cruft GWT seems to think I need?". You can write your own linker if you feel that you know better than google when it comes to the bootloader, but as far as the compiled code itself; the GWT compiler has very aggressive dead code elimination, so any output code will be used at some point.
On Jul 26, 9:21 am, S Rabin <[email protected]> wrote: > I've done quite a bit of searching to find any information about this, > but it seems that people are more concerned with writing GWT libraries > to keep in GWT before compilation. > > I would like to write the libraries I frequently use in my projects in > GWT, then compile and expose them to hand-written Javascript. I have > several issues with the way GWT seems to handle what I want to do: > > 1) Bootstrapping. I understand that the iframe loading method is > highly efficient for large codebases so as to make the page non- > blocking, but for a small library bootstrapping is overkill. To test, > I tried writing my TableGenerator library (a 7kb handwritten non- > minified library) in GWT. The result was a 6 kb deferred binding > loader file (table.nocache.js) and 4 permutations of compiled JS > weighing in at 20-30kb each. Which brings me to issue #2 > > 2) For compiling the code, GWT seems to produce LARGER codebases. > Fast, yes, but how does 3-5kb of source result in 20-30kb of compiled > javascript? Is there a way to crop out all the unnecessary cruft GWT > seems to think I need? > > 3) I would prefer to not have a bootloader - I anticipate the compiled > form of my code is going to be smaller than the bootstrap code and > would rather it just be loaded. Is there a compilation option to > disable permutations and output (obviously more to handle different > implementations) code that works in all browsers? > > Sincerely, > Scott Rabin -- 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.
