[fpc-devel] Sorting tests

Stefan Glienke sglienke at dsharp.org
Mon Nov 28 00:20:30 CET 2022


Probably not unless FPC has something similar to 
https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.IsManagedType 
(that function among a few others is compiletime evaluated).

Am 25.11.2022 um 18:57 schrieb J. Gareth Moreton via fpc-devel:
> 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
>>
> _______________________________________________
> 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