changeset 15490:5d0dd6a6f6b3

mx: improved heuristics for sorting remaining tasks in parallel Java build worklist
author Doug Simon <doug.simon@oracle.com>
date Sun, 04 May 2014 01:28:07 +0200
parents d0e3f6963ed7
children 7f492a524ca7
files mxtool/mx.py
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mxtool/mx.py	Sun May 04 01:26:50 2014 +0200
+++ b/mxtool/mx.py	Sun May 04 01:28:07 2014 +0200
@@ -2140,10 +2140,18 @@
                     task._d = max([remainingDepsDepth(t) for t in incompleteDeps]) + 1
             return task._d
 
+        def compareTasks(t1, t2):
+            d = remainingDepsDepth(t1) - remainingDepsDepth(t2)
+            if d == 0:
+                d = len(t1.proj.annotation_processors()) - len(t2.proj.annotation_processors())
+                if d == 0:
+                    d = len(t1.javafilelist) - len(t2.javafilelist)
+            return d
+
         def sortWorklist(tasks):
             for t in tasks:
                 t._d = None
-            return sorted(tasks, lambda x, y: remainingDepsDepth(x) - remainingDepsDepth(y))
+            return sorted(tasks, compareTasks)
 
         import multiprocessing
         cpus = multiprocessing.cpu_count()