Re: qsort, once again - Mailing list pgsql-hackers

From Dann Corbit
Subject Re: qsort, once again
Date
Msg-id D425483C2C5C9F49B5B7A41F8944154757D688@postal.corporate.connx.com
Whole thread Raw
In response to qsort, once again  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> So my feeling is we should just remove the swap_cnt code and return to
> the original B&M algorithm.  Being much faster than expected for
> presorted input doesn't justify being far slower than expected for
> other inputs, IMHO.  In the context of Postgres I doubt that perfectly
> sorted input shows up very often anyway.
>
> Comments?

Checking for presorted input is O(n).
If the input is random, an average of 3 elements will be tested.
So adding an in-order check of the data should not be too expensive.

I would benchmark several approaches and see which one is best when used
in-place.



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: qsort, once again
Next
From: "Dann Corbit"
Date:
Subject: Re: qsort, once again