optimisation

30 views
Skip to first unread message

Deepak Singh

unread,
Jul 17, 2011, 4:10:31 AM7/17/11
to google-we...@googlegroups.com
hi,

Is declaring cell widgets variable as static an optimisation ?

OR simply declaring a variable as static is an optimisation or simply it does not make any difference as per optimisation / performance is concerned.

Kindly suggest.


Colin Alworth

unread,
Jul 17, 2011, 6:02:43 PM7/17/11
to google-we...@googlegroups.com
The compiler will make the methods it can into static calls. As far as making an instance static (i.e. making a singleton), this probably won't gain you anything for a Cell, which has very little state, but in the case of very large widgets/composites, it might make sense to do.

So Cell, probably not worth it, and Widget, possibly, only if it is very expensive to create. As with almost all optimizations, profile first, then optimize. And make sure you optimize the compiled Javascript, not the Java (though you probably want to compile to PRETTY or DETAILED so you know what to work on).

Deepak Singh

unread,
Jul 18, 2011, 6:09:15 AM7/18/11
to google-we...@googlegroups.com
Thanks Colin, i got it now.

On Mon, Jul 18, 2011 at 3:32 AM, Colin Alworth <nilo...@gmail.com> wrote:
The compiler will make the methods it can into static calls. As far as making an instance static (i.e. making a singleton), this probably won't gain you anything for a Cell, which has very little state, but in the case of very large widgets/composites, it might make sense to do.

So Cell, probably not worth it, and Widget, possibly, only if it is very expensive to create. As with almost all optimizations, profile first, then optimize. And make sure you optimize the compiled Javascript, not the Java (though you probably want to compile to PRETTY or DETAILED so you know what to work on).

--
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/-/yFyWrjRqaXUJ.
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