Reviewers: scottb,

Description:
In trunk, -draftCompile does one full outer loop of the optimization
loop.  This patch pares that one loop down much further.

A one-permutation draft compile of Showcase now takes about 25 seconds,
as compared to 27 seconds before.  Additionally, the actual optimization
step is reduced from about 2.5 seconds to about 500 milliseconds.

Most of the remaining optimization time is in MakeCallsStatic, and that
would be possible to pare down further.  The only calls that really need
to be static are those to methods in a few key classes including String
and Object. I coded that up, but backed it out of this patch because it
looks too complicated for the speedup involved.

At this point the bottleneck looks like the front end: running the JDT
type check and converting the results to GWT internal ASTs.  Here are
some key parts of a perf log on my machine:

ModuleDef.normalize 764ms
CompilationState.compile 8837ms
Precompile 9759ms
   Build AST 2877ms
draft optimize 549ms

The entire compile takes 24424ms.



Please review this at http://gwt-code-reviews.appspot.com/38801

Affected files:
   dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java


Index: dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
===================================================================
--- dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java    
(revision 5538)
+++ dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java    
(working copy)
@@ -366,11 +366,11 @@

          toReturn.getArtifacts().add(
              new StandardCompilationAnalysis(dependencies, stories,  
splitPoints));
-
+
          System.out.println("Completed SOYC phase in "
              + (System.currentTimeMillis() - soycStart) + " ms");
        }
-
+
        System.out.println("Permutation took "
            + (System.currentTimeMillis() - permStart) + " ms");
        return toReturn;
@@ -542,6 +542,10 @@
      }
    }

+  /**
+   * Perform the minimal amount of optimization to make sure the compile
+   * succeeds.
+   */
    protected static void draftOptimize(JProgram jprogram) {
      /*
       * Record the beginning of optimizations; this turns on certain checks  
that
@@ -550,14 +554,17 @@
       */
      jprogram.beginOptimizations();

-    optimizeLoop(jprogram, false);
+    PerfLogger.start("draft optimize");

-    /*
-     * Ensure that references to dead clinits are removed. Otherwise, the
-     * application won't run reliably.
-     */
-    jprogram.typeOracle.recomputeAfterOptimizations();
-    DeadCodeElimination.exec(jprogram);
+    PerfLogger.start("Finalizer");
+    Finalizer.exec(jprogram);
+    PerfLogger.end();
+
+    PerfLogger.start("MakeCallsStatic");
+    MakeCallsStatic.exec(jprogram);
+    PerfLogger.end();
+
+    PerfLogger.end();
    }

    protected static void optimize(JJSOptions options, JProgram jprogram)



--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to