5,337
edits
(→Usage) |
(→Usage) |
||
Line 294: | Line 294: | ||
<< std::chrono::duration_case<std::chrono::milliseconds>(end - start).count() | << std::chrono::duration_case<std::chrono::milliseconds>(end - start).count() | ||
<< " ms" << std::endl; | << " ms" << std::endl; | ||
</syntaxhighlight> | |||
===Execution=== | |||
<code>#include <execution></code><br> | |||
The execution header gives you tools for parallel execution.<br> | |||
See [https://en.cppreference.com/w/cpp/algorithm/execution_policy_tag_t execution_policy_tag].<br> | |||
[https://devblogs.microsoft.com/cppblog/using-c17-parallel-algorithms-for-better-performance/ C++17 Parallel Algorithms blog].<br> | |||
;Example: Parallel Sorting | |||
<syntaxhighlight lang="cpp"> | |||
std::sort(std::execution::par_unseq, sorted.begin(), sorted.end()); | |||
</syntaxhighlight> | </syntaxhighlight> | ||