@@ -225,9 +225,6 @@ ReturnStatus GrowLocalSSP<GraphT>::ComputeSchedule(MaxBspSchedule<GraphT> &sched
225225 currentlyReady_.emplace_back (vert);
226226 }
227227 }
228- if constexpr (not hasVerticesInTopOrderV<GraphT>) {
229- std::sort (currentlyReady_.begin (), currentlyReady_.end (), std::less<>{});
230- }
231228
232229 std::vector<std::vector<VertexType>> newAssignments (numProcs);
233230 std::vector<std::vector<VertexType>> bestNewAssignments (numProcs);
@@ -244,14 +241,6 @@ ReturnStatus GrowLocalSSP<GraphT>::ComputeSchedule(MaxBspSchedule<GraphT> &sched
244241 const unsigned reducedSuperStep = superStep % staleness;
245242
246243 std::deque<VertexType> &stepFutureReady = futureReady_[reducedSuperStep];
247- std::sort (stepFutureReady.begin (), stepFutureReady.end (), std::less<>{});
248- const typename std::deque<VertexType>::difference_type lengthCurrentlyReady
249- = std::distance (currentlyReady_.begin (), currentlyReady_.end ());
250- currentlyReady_.insert (currentlyReady_.end (), stepFutureReady.begin (), stepFutureReady.end ());
251- std::inplace_merge (currentlyReady_.begin (),
252- std::next (currentlyReady_.begin (), lengthCurrentlyReady),
253- currentlyReady_.end (),
254- std::less<>{});
255244
256245 const typename std::deque<VertexType>::difference_type maxCurrentlyReadyUsage
257246 = std::max (static_cast <typename std::deque<VertexType>::difference_type>(
@@ -490,6 +479,17 @@ ReturnStatus GrowLocalSSP<GraphT>::ComputeSchedule(MaxBspSchedule<GraphT> &sched
490479 }
491480 }
492481
482+ std::deque<VertexType> &nextStepFutureReady = futureReady_[nextSuperStep % staleness];
483+ std::sort (nextStepFutureReady.begin (), nextStepFutureReady.end (), std::less<>{});
484+ const typename std::deque<VertexType>::difference_type lengthCurrentlyReady
485+ = std::distance (currentlyReady_.begin (), currentlyReady_.end ());
486+ currentlyReady_.insert (currentlyReady_.end (), nextStepFutureReady.begin (), nextStepFutureReady.end ());
487+ std::inplace_merge (currentlyReady_.begin (),
488+ std::next (currentlyReady_.begin (), lengthCurrentlyReady),
489+ currentlyReady_.end (),
490+ std::less<>{});
491+ nextStepFutureReady.clear ();
492+
493493 ++superStep;
494494 desiredParallelism = (0.3 * desiredParallelism) + (0.6 * bestParallelism)
495495 + (0.1 * static_cast <double >(numProcs)); // weights should sum up to one
0 commit comments