This makes the build times much longer than the normal 6 permutations — but do we gain anything? We can load just the widgets and the State handling code instead, as well as a theme:.
At present, Charts do not allow for this particular change, so I had to make the same change to the Charts. We can also take this in the other direction in two different ways by combining browsers into fewer permutations or by limiting which browsers we intend to support. These 6 browsers only require 4 permutations because once again, we are condensing similar browsers into the same build.
By following the previous step not inheriting GXT directly , we can expand this back to 6 if we wanted — and be slightly more specialized than we were to begin with. Or, we can keep our smaller set. With this smaller set, we can compile in about seconds, and the largest of our four permutations is 2,, bytes, about the same as we started. The second option is to further condense supported browsers into fewer permutations. There are two tools for this option and both rely on the idea of merging permutations.
First, we can specify that one or more property should be collapsed:. This gives us a different set of 4 permutations, the largest at 2,, bytes, and completes in seconds — still faster than our baseline, supporting fewer browsers, and at nearly the same size.
Finally we can tell the compiler that every single property should be collapsed into one permutation:. This is the big one — no matter how many permutations you had configured before this line, only one file will be created.
This is especially handy for very fast builds or cases where you want to keep the build size small such as only one 1. In the case of the Explorer, we bring the compiled size up to 3,, bytes, about K larger, but the compile time drops to just over a minute, from just over three minutes.
The total compiled directory also drops in size, from about 22MB to less than 6MB. If you would like more information, you can learn about properties and permutations on the GWT wiki. Some rewrites are necessary to change Java expressions into JavaScript — instanceof operators and casts are turned into method calls, and all classes and inheritance are tracked in a lookup table.
It also looks for cases where code is easy to read but hard to execute, and rewrites them — fields left at their default values are turned into constants and sometimes compiled away, among many others. All modifications to the way the optimizer works are set when running the compiler, not in the module files. How you set these modifications may vary based on how you build your project — for command line and Ant users, these are arguments passed to the compiler, while for Maven users these are configuration options.
By default, the compiler runs and runs until it is no longer making a difference in the files it is touching. For many applications, this results in 8 to 15 steps through the optimizer before starting on browser-specific details.
This too is configurable, but must always be run at least once to properly transform Java into JavaScript. If we set the optimization level to 0, we are asking for as little optimization to be done as possible, whereas setting it to 9 the default asks the compiler to run until it is no longer able to find anything to optimize.
By default, these are enabled but can be turned off. This is the easiest way to limit the effort that the compiler is putting into building an app. So here's what I found out about the GWT compiler on my quest to speed things up.
Compilation is slow and you cannot get away from it. It is slow because the compiler compiles various versions of your app for different browsers. So since you want to speed compile time for testing there are a few things you can do! This is the good news. Now how fast will it be This way it will compile 1 or 2 versions of your app and not more.
See these 2 links for more in depth information on how to get this done. Products By Bayt. Use Our Mobile App. We're going to start altering our working practices to mitigate the problem, including a greater emphasis on the hosted-mode browser, which defers the need to run the GWT compiler until a later time, but that brings its own risks, particularly that of not catching issues with real browsers until much later than we'd like.
Ideally, we'd like to make the GWT compiler itself quicker - a minute to compile a fairly small application is taking the piss. However, we are using the compile if a fairly naive fashion, so I'm hoping we can make some quick and easy gains.
We're currently invoking com. Compiler as a java application from ant Ant target, with m max heap and lots of stack space. We pass our main controller class to the compiler along with the application classpath, and off it goes. What else can we do to get some extra speed? Can we give it more information so it spends less time doing discovery of what to do? I know we can tell it to only compile for one browser, but we need to do multi-browser testing, so that's not really practical.
All suggestions welcome at this point.
0コメント