synchronized DeltaTask.Slice remaining() { int e = end; int halfRemaining = (e - cur) >>> 1; if (0 == halfRemaining) return null; int split = e - halfRemaining; int h = toSearch[split].getPathHash(); // Attempt to split on the next path after the 50% split point. for (int n = split + 1; n < e; n++) { if (h != toSearch[n].getPathHash()) return new DeltaTask.Slice(n, e); } if (h != toSearch[cur].getPathHash()) { // Try to split on the path before the 50% split point. // Do not split the path currently being processed. for (int p = split - 1; cur < p; p--) { if (h != toSearch[p].getPathHash()) return new DeltaTask.Slice(p + 1, e); } } return null; }
synchronized DeltaTask.Slice remaining() { int e = end; int halfRemaining = (e - cur) >>> 1; if (0 == halfRemaining) return null; int split = e - halfRemaining; int h = toSearch[split].getPathHash(); // Attempt to split on the next path after the 50% split point. for (int n = split + 1; n < e; n++) { if (h != toSearch[n].getPathHash()) return new DeltaTask.Slice(n, e); } if (h != toSearch[cur].getPathHash()) { // Try to split on the path before the 50% split point. // Do not split the path currently being processed. for (int p = split - 1; cur < p; p--) { if (h != toSearch[p].getPathHash()) return new DeltaTask.Slice(p + 1, e); } } return null; }
synchronized DeltaWindow stealWork(DeltaTask forThread) { for (;;) { DeltaTask maxTask = null; Slice maxSlice = null; int maxWork = 0; for (DeltaTask task : tasks) { Slice s = task.remaining(); if (s != null && maxWork < s.size()) { maxTask = task; maxSlice = s; maxWork = s.size(); } } if (maxTask == null) { return null; } if (maxTask.tryStealWork(maxSlice)) { return forThread.initWindow(maxSlice); } } }
synchronized DeltaWindow stealWork(DeltaTask forThread) { for (;;) { DeltaTask maxTask = null; Slice maxSlice = null; int maxWork = 0; for (DeltaTask task : tasks) { Slice s = task.remaining(); if (s != null && maxWork < s.size()) { maxTask = task; maxSlice = s; maxWork = s.size(); } } if (maxTask == null) { return null; } if (maxTask.tryStealWork(maxSlice)) { return forThread.initWindow(maxSlice); } } }
void add(Slice s) { if (!slices.isEmpty()) { Slice last = slices.getLast(); if (last.endIndex == s.beginIndex) { slices.removeLast(); slices.add(new Slice(last.beginIndex, s.endIndex)); return; } } slices.add(s); }
void add(Slice s) { if (!slices.isEmpty()) { Slice last = slices.getLast(); if (last.endIndex == s.beginIndex) { slices.removeLast(); slices.add(new Slice(last.beginIndex, s.endIndex)); return; } } slices.add(s); }
synchronized DeltaTask.Slice remaining() { int e = end; int halfRemaining = (e - cur) >>> 1; if (0 == halfRemaining) return null; int split = e - halfRemaining; int h = toSearch[split].getPathHash(); // Attempt to split on the next path after the 50% split point. for (int n = split + 1; n < e; n++) { if (h != toSearch[n].getPathHash()) return new DeltaTask.Slice(n, e); } if (h != toSearch[cur].getPathHash()) { // Try to split on the path before the 50% split point. // Do not split the path currently being processed. for (int p = split - 1; cur < p; p--) { if (h != toSearch[p].getPathHash()) return new DeltaTask.Slice(p + 1, e); } } return null; }
synchronized DeltaWindow stealWork(DeltaTask forThread) { for (;;) { DeltaTask maxTask = null; Slice maxSlice = null; int maxWork = 0; for (DeltaTask task : tasks) { Slice s = task.remaining(); if (s != null && maxWork < s.size()) { maxTask = task; maxSlice = s; maxWork = s.size(); } } if (maxTask == null) { return null; } if (maxTask.tryStealWork(maxSlice)) { return forThread.initWindow(maxSlice); } } }
void add(Slice s) { if (!slices.isEmpty()) { Slice last = slices.getLast(); if (last.endIndex == s.beginIndex) { slices.removeLast(); slices.add(new Slice(last.beginIndex, s.endIndex)); return; } } slices.add(s); }