Sorting algorithm

Xinok xinok at live.com
Fri Oct 7 21:00:45 PDT 2011


On 10/7/2011 5:08 PM, Andrei Alexandrescu wrote:
> On 10/07/11 13:50, Xinok wrote:
>> On 10/7/2011 2:20 PM, Andrei Alexandrescu wrote:
>>> On 10/7/11 12:23 PM, Xinok wrote:
>>>>>> http://www.neowin.net/forum/blog/422/entry-3737-sort-algorithm-complete/
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> This is interesting. What do the numbers in the benchmark represent?
>>>>>
>>>>> Andrei
>>>>
>>>> I'll just post the code I used for benchmarking. Simply put, smaller
>>>> numbers are faster.
>>> [snip]
>>>
>>> Thanks. It would be great if you wanted to contribute your stable sort
>>> to Phobos via a pull request.
>>>
>>> Also, which version of D are you using? I'm seeing that
>>> std.algorithm.sort (introSort) performs quite badly; for example, it's
>>> twice as slow on shuffled data against quickSort, and it also deals
>>> badly with already sorted data. Generally it does much worse than the
>>> quickSort baseline. Wonder why.
>>>
>>>
>>> Andrei
>>
>> I'm not familiar with the process. What all would I need to do to
>> contribute my sort to Phobos?
>
> D's standard library is on github:
> https://github.com/D-Programming-Language/phobos. Anyone can fork it,
> modify it as they please, and then submit the changes for review via a
> so-called "pull request". Here's an example of a pull request with
> comments and all:
> https://github.com/D-Programming-Language/phobos/pull/272. There is
> documentation available on github.com about how to use the site. It's
> some work but it's time well invested - the kin of git and github are
> here to stay. Would anyone in the community be willing to shepherd Xinok
> through the first pull request?
>
>
> Andrei

Thanks, I'll look into it when I have a little more time.

If my algorithm were to be implemented in Phobos, the template arguments 
for std.algorithm.sort would need to be modified. For my algorithm to be 
stable, it requires defining two conditions, both a 'less' and 'greater'.


More information about the Digitalmars-d mailing list