Skip to content

kobi-ca/quicksort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.