jQuery in GWT?
jQuery in GWT?
Did you see this over at Ajaxian in the GWT discussion?
@polterguy, GWT will create more optimal code in general than hand
written in JS in non-trivial projects. To beat GWT, you’d have to
write ugly, non-idiomatic JS, which would be a pain to maintain.
GWT interns all strings, folds expressions at compile time,
devirtualizes polymorphic methods and shortens or eliminates prototype
chains, significantly speeding up JS execution. Any hand written JS
library that uses mixins or prototype inheritance will be slower. Any
JS library that uses closures everywhere will be slower and chew up
more memory.
Let me give you a great example. I ported jQuery to GWT, almost
line for line. The GWT compiled version is faster. Are you saying John
Resig is not a good JS programmer?
Besides performance, JS libraries are guaranteed to be bigger. GWT
can aggressively prune and obfuscate in ways that are impossible for
JS minifier/packers. My jQuery clone compiles CSS selectors ahead of
time, and prunes any method not used. The code output is usually 5x
smaller than minified/packed/gzipped jQuery.
Religious zealotry about languages is pointless. GWT is real
compiler technology. It can’t be hand waved away without understanding
what it does.