Mercurial > hg > truffle
comparison mxtool/mx.py @ 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 | f5eba273a4f2 |
comparison
equal
deleted
inserted
replaced
15489:d0e3f6963ed7 | 15490:5d0dd6a6f6b3 |
---|---|
2138 task._d = 0 | 2138 task._d = 0 |
2139 else: | 2139 else: |
2140 task._d = max([remainingDepsDepth(t) for t in incompleteDeps]) + 1 | 2140 task._d = max([remainingDepsDepth(t) for t in incompleteDeps]) + 1 |
2141 return task._d | 2141 return task._d |
2142 | 2142 |
2143 def compareTasks(t1, t2): | |
2144 d = remainingDepsDepth(t1) - remainingDepsDepth(t2) | |
2145 if d == 0: | |
2146 d = len(t1.proj.annotation_processors()) - len(t2.proj.annotation_processors()) | |
2147 if d == 0: | |
2148 d = len(t1.javafilelist) - len(t2.javafilelist) | |
2149 return d | |
2150 | |
2143 def sortWorklist(tasks): | 2151 def sortWorklist(tasks): |
2144 for t in tasks: | 2152 for t in tasks: |
2145 t._d = None | 2153 t._d = None |
2146 return sorted(tasks, lambda x, y: remainingDepsDepth(x) - remainingDepsDepth(y)) | 2154 return sorted(tasks, compareTasks) |
2147 | 2155 |
2148 import multiprocessing | 2156 import multiprocessing |
2149 cpus = multiprocessing.cpu_count() | 2157 cpus = multiprocessing.cpu_count() |
2150 worklist = sortWorklist(tasks.values()) | 2158 worklist = sortWorklist(tasks.values()) |
2151 active = [] | 2159 active = [] |