quicksort playgraound
Original page from geeksforgeeks https://www.geeksforgeeks.org/quick-sort/
Benchmarks using online quick-bench.com:
Using lambda to compare - 1.8 or 2 slower
with do-not-optimize (is_sorted)
new with span passed by value
needed to install gcc/g++ 10 to get span<> header
Short arrays - clang is better
longer arrays - clang is also worse now
longer arrays with const& span<>
Bypassing span, using to_array - without pivot, O3 long arrays (ignore for now)
without pivot compare, span by value O3 long arrays
without pivot compare, span by const ref O3 long arrays
clang - calling _impl directly - https://quick-bench.com/q/X0C3OQdHw_o8YddIejgqdAtFLJw
O2 - no const calling _impl directly (clang is faster)
more consts O2 - all const calling _impl directly (gcc - same, clang - worse )
O3 with const std::span<> long arrays (without pivot compare)
O3 with const std::span<> long arrays (with pivot compare) shows worse than without pivot compare
separate - almost the same
gcc - sort running before geeks
gcc sort - remove const& from func param a bit slower. so const does help
Godbolt
5/22/2021 after working with Jason Turner on Discord.