[erlang-questions] algorithm of lists:sort?
Wed Nov 21 22:45:17 CET 2012
I was wondering whether some of them could be removed now that the
compiler optimizes a lot more things than when I suppose it was written?
On 11/21/2012 10:42 PM, Paul Fisher wrote:
> It is a merge sort. My recollection last I looked is that all the extra functions and patterns are manually unrolled optimizations.
> On Nov 21, 2012, at 1:48 PM, "Motiejus Jakštys" <> wrote:
>> I am looking at implementation of lists:sort. I need to describe it to
>> my colleague, so he can implement an analogous version in C++ (he does
>> not know Erlang). Looking at the code it is very non-obvious how it
>> works. There is a lot of pattern matching, but it is very hard to get
>> the picture. Trapexit says it's a merge sort. But why is the
>> implementation so big?
>> Functions involved in lists:sort:
>> ... and so on ...
>> If anyone knows its internals, I would very much appreciate a high
>> level description of the algorithm. Maybe with brief description what
>> the merge_x_x and split_x_x functions are doing?
>> : http://www.trapexit.org/String_Sort_List
>> erlang-questions mailing list
> erlang-questions mailing list
More information about the erlang-questions