# HG changeset patch # User Doug Simon # Date 1399159687 -7200 # Node ID 5d0dd6a6f6b3f95fd95a7c92332ecd6091e28584 # Parent d0e3f6963ed78039b9a847df7cd83f9770fd6584 mx: improved heuristics for sorting remaining tasks in parallel Java build worklist diff -r d0e3f6963ed7 -r 5d0dd6a6f6b3 mxtool/mx.py --- 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()