Wednesday, August 31, 2016

Re: Max optimization level (-optmize 9) causes an infinite loop with GWT 2.8-RC2

On Wednesday, August 31, 2016 at 10:00:41 AM UTC+2, Ali Jalal wrote:

I have some big projects (with about 500 views) which their web-mode compilation was working with GWT 2.7 and their compilation were completed in about 3 minutes.

After upgrading GWT to 2.8-RC2, their web-mode compilation were not completed after more than 60 minutes and it seems that created an infinite loop.

 I traced methods calls in compilation and I think there was a loop in calling JsInliner class.

After adding '-optimize 8' in compiler options (previously there was no -optmize parameter and so it was set to '-optmize 9'), all projects where compiled successfully.

Note that compiler with no -optimize parameter works well in some projects, but do not complete in some big projects.

I compared output JS size in optimization level 8 & 9 and optimization level 8 output JS size was smaller. So I applied '-optimize 8' to all projects.

My question is whats difference between optimization level 8 & 9

At level 9, the compiler (in JavaToJavaScriptCompiler) optimizes Java and JS until it cannot do any more changes (except it stops Java optimizations after 100 iterations; JS optimization iterations are not capped though). At level 8, the compiler only makes 8 optimization iterations, and will stop optimizing Java when the rate of changes is lower than 0.1 (if it reaches that threshold before the 8th iteration).
and what situations may produce an infinite loop?

There may be risks of infinite loops in each optimization step/pass, but as seen above, there's a risk of infinite loop in JS optimization at level 9, in case optimization steps change the JS AST at each pass.

In any case, that'd be a bug. Can you please file an issue on the issue tracker?

You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment