[fpc-devel] Sorting tests

J. Gareth Moreton gareth at moreton-family.com
Fri Nov 25 18:57:03 CET 2022


Indeed.  I'm just trying to think if there's a way that that can be 
implemented in a cross-platform way, or if there's a wa to identify if a 
generic type is a pointer/managed type.

Kit

On 25/11/2022 16:00, Stefan Glienke via fpc-devel wrote:
> >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
> _______________________________________________
> 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