3 ms·
Regardless of your opinion of Java as a language, there are some significant advantages to having a real compiler that targets JS...per the 10000-foot GWT intro
by revetkn 17y ago
Regardless of your opinion of Java as a language, there are some significant advantages to having a real compiler that targets JS...per the 10000-foot GWT intro:
"[it] performs comprehensive static analysis and optimizations across your entire GWT codebase, often producing JavaScript that loads and executes faster than equivalent handwritten JavaScript. For example, the GWT compiler safely eliminates dead code -- aggressively pruning unused classes, methods, fields, and even method parameters -- to ensure that your compiled script is the smallest it can possibly be. Another example: the GWT compiler selectively inlines methods, eliminating the performance overhead of method calls."
The compiler produces tight and gzip/eternal-cache-friendly JS. For supported browser type and supported locale in your application, the compiler will generate a permutation specific to that combination and automatically serve that up, e.g. Chinese Webkit users will be served Webkit-optimized code and only the Chinese localizations instead of getting code that contains IE6 hacks and English localizations.
There are lots of other benefits - for example, GWT 2.0 will include code splitting, which will allow you to fetch code when you need it instead of a huge monolithic upfront download of your entire application.
There are drawbacks to GWT, but going back to "regular" web programming feels like dropping into assembler after you've become acclimated to coding in a high-level language.