[gwt-contrib] Change in gwt[master]: reduces Java AST optimization time by bailing out when the r...

2013-05-08 Thread John Stalcup

John Stalcup has abandoned this change.

Change subject: reduces Java AST optimization time by bailing out when the  
rate of change slows to a crawl (only applies on optimization levels less  
than 9)

..


Abandoned

submitted

--
To view, visit https://gwt-review.googlesource.com/2580
To unsubscribe, visit https://gwt-review.googlesource.com/settings

Gerrit-MessageType: abandon
Gerrit-Change-Id: Iabf844d6a02f694e8d14103377f74f46e4e01915
Gerrit-PatchSet: 1
Gerrit-Project: gwt
Gerrit-Branch: master
Gerrit-Owner: John Stalcup stal...@google.com
Gerrit-Reviewer: Roberto Lublinerman rlu...@google.com

--
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
--- 
You received this message because you are subscribed to the Google Groups Google Web Toolkit Contributors group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[gwt-contrib] Change in gwt[master]: reduces Java AST optimization time by bailing out when the r...

2013-04-23 Thread Roberto Lublinerman

Roberto Lublinerman has posted comments on this change.

Change subject: reduces Java AST optimization time by bailing out when the  
rate of change slows to a crawl (only applies on optimization levels less  
than 9)

..


Patch Set 1: Code-Review+1

(1 comment)


File dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
Line 813: if (options.isAggressivelyOptimize()) {
I think we should also make the default of aggresivelyOptimize be false.


--
To view, visit https://gwt-review.googlesource.com/2580
To unsubscribe, visit https://gwt-review.googlesource.com/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Iabf844d6a02f694e8d14103377f74f46e4e01915
Gerrit-PatchSet: 1
Gerrit-Project: gwt
Gerrit-Branch: master
Gerrit-Owner: John Stalcup stal...@google.com
Gerrit-Reviewer: Roberto Lublinerman rlu...@google.com
Gerrit-HasComments: Yes

--
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
--- 
You received this message because you are subscribed to the Google Groups Google Web Toolkit Contributors group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[gwt-contrib] Change in gwt[master]: reduces Java AST optimization time by bailing out when the r...

2013-04-23 Thread John Stalcup

John Stalcup has uploaded a new change for review.

  https://gwt-review.googlesource.com/2580


Change subject: reduces Java AST optimization time by bailing out when the  
rate of change slows to a crawl (only applies on optimization levels less  
than 9)

..

reduces Java AST optimization time by bailing out when the rate of change  
slows to a crawl (only applies on optimization levels less than 9)


Change-Id: Iabf844d6a02f694e8d14103377f74f46e4e01915
---
M dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
1 file changed, 57 insertions(+), 26 deletions(-)



diff --git  
a/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java  
b/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java

index b7ccabb..431ab9d 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
@@ -252,15 +252,27 @@
   private static final String ENUM_NAME_OBFUSCATION_PROPERTY  
= compiler.enum.obfuscate.names;


   /**
+   * Continuing to apply optimizations till the rate of change reaches  
this value causes the AST to

+   * reach a fixed point.
+   */
+  private static final int FIXED_POINT_CHANGE_RATE = 0;
+
+  /**
+   * Ending optimization passes when the rate of change has reached this  
value results in
+   * gaining nearly all of the impact while avoiding the long tail of  
costly but low-impact passes.

+   */
+  private static final float EFFICIENT_CHANGE_RATE = 0.01f;
+
+  /**
* Compiles a particular permutation, based on a precompiled unified AST.
*
* @param logger the logger to use
-   * @param unifiedAst the result of a
-   *  {@link #precompile(TreeLogger, ModuleDef,  
RebindPermutationOracle, String[], String[], JJSOptions, boolean,  
PrecompilationMetricsArtifact)}
+   * @param unifiedAst the result of a {@link #precompile(TreeLogger,  
ModuleDef,
+   *  RebindPermutationOracle, String[], String[], JJSOptions,  
boolean,

+   *  PrecompilationMetricsArtifact)}
* @param permutation the permutation to compile
* @return the output JavaScript
-   * @throws UnableToCompleteException if an error other than
-   *   {@link OutOfMemoryError} occurs
+   * @throws UnableToCompleteException if an error other than {@link  
OutOfMemoryError} occurs

*/
   public static PermutationResult compilePermutation(TreeLogger logger,  
UnifiedAst unifiedAst,

   Permutation permutation) throws UnableToCompleteException {
@@ -768,11 +780,16 @@
 Event optimizeEvent =  
SpeedTracerLogger.start(CompilerEventType.OPTIMIZE);


 ListOptimizerStats allOptimizerStats = new  
ArrayListOptimizerStats();

-int counter = 0;
-int optimizationLevel = options.getOptimizationLevel();
+int passCount = 0;
+int nodeCount = getNodeCount(jprogram);
+int lastNodeCount;
+
+int passLimit = options.getOptimizationLevel();
+float minimumChangeRate = passLimit  OptionOptimize.OPTIMIZE_LEVEL_MAX
+? EFFICIENT_CHANGE_RATE : FIXED_POINT_CHANGE_RATE;
 while (true) {
-  counter++;
-  if (optimizationLevel  OptionOptimize.OPTIMIZE_LEVEL_MAX  counter  

optimizationLevel) {

+  passCount++;
+  if (passLimit  OptionOptimize.OPTIMIZE_LEVEL_MAX  passCount   
passLimit) {

 break;
   }
   if (Thread.interrupted()) {
@@ -781,9 +798,14 @@
   }
   AstDumper.maybeDumpAST(jprogram);
   OptimizerStats stats =
-  optimizeLoop(Pass  + counter, jprogram,  
options.isAggressivelyOptimize());
+  optimizeLoop(Pass  + passCount, jprogram,  
options.isAggressivelyOptimize(), nodeCount);

   allOptimizerStats.add(stats);
-  if (!stats.didChange()) {
+  lastNodeCount = nodeCount;
+  nodeCount = getNodeCount(jprogram);
+
+  float nodeChangeRate = stats.getNumMods() / (float) lastNodeCount;
+  float sizeChangeRate = (lastNodeCount - nodeCount) / (float)  
lastNodeCount;
+  if (nodeChangeRate = minimumChangeRate  sizeChangeRate =  
minimumChangeRate) {

 break;
   }
 }
@@ -849,15 +871,15 @@

   protected static OptimizerStats optimizeLoop(String passName, JProgram  
jprogram,

   boolean isAggressivelyOptimize) {
-Event optimizeEvent =  
SpeedTracerLogger.start(CompilerEventType.OPTIMIZE, phase, loop);

-
-// Count the number of nodes in the AST so we can measure the  
efficiency of

-// the optimizers.
-Event countEvent =  
SpeedTracerLogger.start(CompilerEventType.OPTIMIZE, phase, countNodes);

 TreeStatistics treeStats = new TreeStatistics();
 treeStats.accept(jprogram);
-int numNodes = treeStats.getNodeCount();
-countEvent.end();
+int nodeCount = treeStats.getNodeCount();
+return optimizeLoop(Early Optimization, jprogram, false, nodeCount);
+  }
+
+  protected static OptimizerStats optimizeLoop(String passName, JProgram  
jprogram,

+