[fpc-devel] Sorting tests

Marco van de Voort fpc at pascalprogramming.org
Tue Nov 29 17:36:32 CET 2022

On 29-11-2022 17:34, J. Gareth Moreton via fpc-devel wrote:
> This is why I hope my own improvement to the version in TArrayHelper 
> could be used instead:
> https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/334
> Now that I know where Introsort is in the sortalgs.pp unit, I'll see 
> about improving Introsort there too.
> Regarding a stable sort, what does GCC's "std::stable_sort" use? 
> https://www.youtube.com/watch?v=kPRA0W1kECg&t=3m5s - it resembles 
> merge sort.  (The algorithm before it in the video, "std::sort", is 
> introsort, but it postpones doing the insertion sort until the very 
> end, which doesn't work in practice because of caching issues)

Usually it is heapsort that is picked as alternative to quicksort if 
stable algo is needed.

More information about the fpc-devel mailing list