[phobos] std.algorithm.sort slow as molasses
Andrei Alexandrescu
andrei at erdani.com
Fri Jul 2 13:39:01 PDT 2010
Walter Bright wrote:
>
>
> Andrei Alexandrescu wrote:
>> Working around that would mess much of the elegance of std.sort, sigh.
>> The nice thing is that sort reuses partition instead of writing a
>> dedicated version of it (as I had in my implementation for a while). I
>> was quite glad I'd pulled that off.
>>
>
> Most heavily optimized implementations of things tend to have lost their
> elegance. qsort is no stranger to that. Just look at all the nasty
> things people do trying to make memcpy() run faster!
As I said before, I have no simpathy for that position. That crap is
sometimes necessary doesn't mean we should endorse it. We should allow
inlining of that function if that's the performance problem, not replace
it with a workaround.
Andrei
More information about the phobos
mailing list