Jump to content
Tom de Neef

Fast stable sorting routines

Recommended Posts

(This is a re-start of another thread)

I have published Delphi sorting routines that ought to be similar in speed to TIMsort, for arrays of simple types, strings and objects.

The focus has been on large (10M+) real-world situations, where there is already some order in the data.

The documentation explains how to use in case you do not want generics.

The software is free: https://sourceforge.net/projects/fast-stable-sorting-in-delphi/   It includes a test suite.

Stable sorting of objects with QuickSort is possible by adding to the object a tag that can serve as stability key. In that way I compare sorting speeds of my procedures with Tarray.sort<Tobject>. For (semi-)random data the difference is 5-10 times. When there is already order in the data, the improvement may go up to a factor of 20.

I chose some optimization parameters on the basis of the test arrays that I generated. It would be nice to know if attractive results are obtained when applied to real-world data.

  • Like 2
  • Thanks 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×