gwtc X closure optimizations

97 views
Skip to first unread message

Magno Machado

unread,
Jul 4, 2012, 11:37:08 PM7/4/12
to Google-We...@googlegroups.com
I was impressed to see the results achieved on gwt 2.5 by combining the gwt compiler and closure compiler.

Well, I always thought there's nothing that closure could do that the gwt compiler couldn't already do, because gwtc have a lot more information about the source than closure compiler.

So I wonder what kind of optimizations closure is doing that were not already done by the gwt compiler?

--
Magno Machado Paulo
http://blog.magnomachado.com.br
http://code.google.com/p/emballo/

Thomas Broyer

unread,
Jul 5, 2012, 12:31:47 PM7/5/12
to google-we...@googlegroups.com, Google-We...@googlegroups.com


On Thursday, July 5, 2012 5:37:08 AM UTC+2, Magno Machado wrote:
I was impressed to see the results achieved on gwt 2.5 by combining the gwt compiler and closure compiler.

Well, I always thought there's nothing that closure could do that the gwt compiler couldn't already do, because gwtc have a lot more information about the source than closure compiler.

Yes and no: Closure has "static typing" via JSDoc annotations, and uses the same kind of monolithic compilation (i.e. I know everything about what will run, so I know what is never used that I can remove).

So I wonder what kind of optimizations closure is doing that were not already done by the gwt compiler?

One small optimization I've read on the Closure Compiler group that I know GWT doesn't do: ["ab", "cd", "ef", "ghij"] is compiled into "ab,cd,ef,ghij".split(",") !
(it's more in terms of perfs than in code size I guess though).
I don't know about the other differences.

Alan Leung

unread,
Jul 9, 2012, 1:19:14 PM7/9/12
to google-we...@googlegroups.com
A few more noteworthy ones:

Variable name reuse:
  var x = .....;  print(x); var y = ......; print(y)
  becomes
    var x = .....;  print(x);   x  = ......; print(x)

More aggressive inlining with variables and functions.

A lot more small optimizations that saves a char here and there.

Closure Compiler would also put more effort into your JSNI code for obvious reasons.

-Alan



--
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/-/EBpT-fnjCHcJ.

To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Reply all
Reply to author
Forward
0 new messages