std.partition is fucked

Lutger lutger.blijdestijn at gmail.com
Wed May 13 15:22:19 PDT 2009


Sean Kelly wrote:

> == Quote from Lutger (lutger.blijdestijn at gmail.com)'s article
>>
>> Some time ago I reinvented these wheels for study purpose. A custom stack was a little faster but not
> that much. std.swap can't be inlined because it uses ref params, that cost also a bit since it's called
>> many times. Switching to another sort if a certain recursion depth is reached helped, but mostly in
> degenerate cases.
>> I still have the thing somewhere, it is about twice as fast as builtin sort. It's not a lot of work but I could
> dig it up and provide some timings if you want.
> 
> The sort I wrote for Tango uses the same basic heuristics, thanks to
> a ticket that either you or Stewart Gordon submitted long ago.  I've
> been meaning to compare it against the sort routine in std.algorithm
> to see whether the Phobos routine could benefit from any of the same
> tweaks.

It wasn't me, I used the Tango code as one the sources to study this algorithm :)




More information about the Digitalmars-d mailing list