pgsql: Replace insertion sort in contrib/intarray with qsort().

Started by Tom Laneover 11 years ago1 messagescomitters
Jump to latest
#1Tom Lane
tgl@sss.pgh.pa.us

Replace insertion sort in contrib/intarray with qsort().

It's all very well to claim that a simplistic sort is fast in easy
cases, but O(N^2) in the worst case is not good ... especially if the
worst case is as easy to hit as "descending order input". Replace that
bit with our standard qsort.

Per bug #12866 from Maksym Boguk. Back-patch to all active branches.

Branch
------
REL9_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/904e8b627c2547e93112080aac9381bbf39e8e99

Modified Files
--------------
contrib/intarray/_int_tool.c | 52 +++++++++++++++++++-----------------------
1 file changed, 23 insertions(+), 29 deletions(-)

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers