Speed improvements and slowups 3.0.x to latest 3.1.x

Søren Hauberg soren at hauberg.org
Sat Feb 7 02:47:04 CST 2009


lør, 07 02 2009 kl. 08:22 +0100, skrev Jaroslav Hajek:
> 1. the algorithm, borrowed from Python, is really targeted to sorting
> arrays containing already sorted segments, i.e. re-sorting. I did a
> few experiments here ind it seems that std::sort from gcc 4.3,
> implementing introsort, wins for random arrays but gets beaten for
> arrays that contain a lot of sorted segments. Maybe we could create a
> hybrid, falling back to std::sort if no long runs are detected.

The 'sort' help text says

     For equal elements, the indices are such that the equal elements
     are listed in the order that appeared in the original list.

Does std::sort make this guaranty?

Søren



More information about the Octave-maintainers mailing list