[fpc-devel] Sorting tests

Stefan Glienke sglienke at dsharp.org
Fri Nov 25 17:00:44 CET 2022


>From experience I can tell that IntroSort is fast enough.

The main performance improvement usually comes from treating anything that is a managed type such as strings as Pointers - instead of three string assignments that cause a bunch of unnecessary atomic operations you then just have 3 pointer assignments. And with anything inside of IntroSort there are just swaps that can go without any reference counting.


> On 24/11/2022 19:51 CET J. Gareth Moreton via fpc-devel <fpc-devel at lists.freepascal.org> wrote:
> 
>  
> Hi everyone,
> 
> I just need to touch on the knowledge base.  What tests exist that test 
> the functionality of rtl/inc/sortbase.pp?  As Olly suggested, I'm 
> looking at creating Introsort for this unit as well, but I need to know 
> if such a unit already exists or if I need to make my own.
> 
> Also, since Olly mentioned that the unit is used in TStringList, it 
> makes me wonder if the RTL has a radix sort algorithm available, since 
> radix sort is on the order of O(n) and is ideal for sorting large arrays 
> of strings (although it can be memory-intensive).
> 
> Kit
> 
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


More information about the fpc-devel mailing list