MCPcopy Create free account
hub / github.com/cameron314/concurrentqueue / parallel_quick_sort

Function parallel_quick_sort

benchmarks/tbb/parallel_sort.h:150–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148/** @ingroup algorithms */
149template<typename RandomAccessIterator, typename Compare>
150void parallel_quick_sort( RandomAccessIterator begin, RandomAccessIterator end, const Compare& comp ) {
151#if __TBB_TASK_GROUP_CONTEXT
152 task_group_context my_context;
153 const int serial_cutoff = 9;
154
155 __TBB_ASSERT( begin + serial_cutoff < end, "min_parallel_size is smaller than serial cutoff?" );
156 RandomAccessIterator k;
157 for ( k = begin ; k != begin + serial_cutoff; ++k ) {
158 if ( comp( *(k+1), *k ) ) {
159 goto do_parallel_quick_sort;
160 }
161 }
162
163 parallel_for( blocked_range<RandomAccessIterator>(k+1, end),
164 quick_sort_pretest_body<RandomAccessIterator,Compare>(comp),
165 auto_partitioner(),
166 my_context);
167
168 if (my_context.is_group_execution_cancelled())
169do_parallel_quick_sort:
170#endif /* __TBB_TASK_GROUP_CONTEXT */
171 parallel_for( quick_sort_range<RandomAccessIterator,Compare>(begin, end-begin, comp ),
172 quick_sort_body<RandomAccessIterator,Compare>(),
173 auto_partitioner() );
174}
175
176} // namespace internal
177//! @endcond

Callers 1

parallel_sortFunction · 0.85

Calls 4

compFunction · 0.85
auto_partitionerClass · 0.85
parallel_forFunction · 0.70

Tested by

no test coverage detected