项目作者: kobi-ca

项目描述 :
quicksort playgraound
高级语言: C++
项目地址: git://github.com/kobi-ca/quicksort.git
创建时间: 2021-05-10T03:23:51Z
项目社区:https://github.com/kobi-ca/quicksort

开源协议:MIT License

下载


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

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.