Thread overview
array.sort - What algorithm is being used here?
Sep 16, 2012
Daniel Harper
Sep 16, 2012
jerro
Sep 16, 2012
Daniel Harper
Sep 16, 2012
deadalnix
Sep 17, 2012
Jonathan M Davis
Sep 17, 2012
Peter Alexander
September 16, 2012
It's not clear in the documentation (http://dlang.org/arrays.html) what sorting algorithm is being used behind the array.sort implementation.

Can anyone shed any light? I.e. is it quicksort?
September 16, 2012
On Sunday, 16 September 2012 at 20:29:50 UTC, Daniel Harper wrote:
> It's not clear in the documentation (http://dlang.org/arrays.html) what sorting algorithm is being used behind the array.sort implementation.
>
> Can anyone shed any light? I.e. is it quicksort?

It is. The source is here https://github.com/D-Programming-Language/druntime/blob/master/src/rt/qsort.d . You should probably be using std.algorithm.sort, though.
September 16, 2012
On Sunday, 16 September 2012 at 20:52:03 UTC, jerro wrote:
> On Sunday, 16 September 2012 at 20:29:50 UTC, Daniel Harper wrote:
>> It's not clear in the documentation (http://dlang.org/arrays.html) what sorting algorithm is being used behind the array.sort implementation.
>>
>> Can anyone shed any light? I.e. is it quicksort?
>
> It is. The source is here https://github.com/D-Programming-Language/druntime/blob/master/src/rt/qsort.d . You should probably be using std.algorithm.sort, though.

Thanks for the prompt reply.

Perhaps the documentation can be updated to reflect this?
September 16, 2012
Le 17/09/2012 00:29, Daniel Harper a écrit :
> On Sunday, 16 September 2012 at 20:52:03 UTC, jerro wrote:
>> On Sunday, 16 September 2012 at 20:29:50 UTC, Daniel Harper wrote:
>>> It's not clear in the documentation (http://dlang.org/arrays.html)
>>> what sorting algorithm is being used behind the array.sort
>>> implementation.
>>>
>>> Can anyone shed any light? I.e. is it quicksort?
>>
>> It is. The source is here
>> https://github.com/D-Programming-Language/druntime/blob/master/src/rt/qsort.d
>> . You should probably be using std.algorithm.sort, though.
>
> Thanks for the prompt reply.
>
> Perhaps the documentation can be updated to reflect this?

I'd argue that .sort must be blasted out of existence.
September 17, 2012
On Monday, September 17, 2012 00:42:40 deadalnix wrote:
> I'd argue that .sort must be blasted out of existence.

I can't remember if it was agreed that it should be deprecated or not. Too many items like that are _supposed_ to be deprecated (with Walter's full agreement) but still persist, but I don't remember if Walter agreed to axe this one or not. I definitely think that it should go though.

- Jonathan M Davis
September 17, 2012
On Monday, 17 September 2012 at 00:09:36 UTC, Jonathan M Davis wrote:
> On Monday, September 17, 2012 00:42:40 deadalnix wrote:
>> I'd argue that .sort must be blasted out of existence.
>
> I can't remember if it was agreed that it should be deprecated or not. Too
> many items like that are _supposed_ to be deprecated (with Walter's full
> agreement) but still persist, but I don't remember if Walter agreed to axe
> this one or not. I definitely think that it should go though.
>
> - Jonathan M Davis

It's on the deprecated list (3rd from bottom): http://dlang.org/deprecate.html

No schedule for deprecation though. Just says "future".