]> granicus.if.org Git - postgresql/commit
Replace insertion sort in contrib/intarray with qsort().
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 16 Mar 2015 03:22:03 +0000 (23:22 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 16 Mar 2015 03:22:03 +0000 (23:22 -0400)
commit904e8b627c2547e93112080aac9381bbf39e8e99
tree46e87fab125cc7403df0b940350c88420253bc8e
parent837eb0846190bef65575b642a0ee8a3b3fedbafe
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.
contrib/intarray/_int_tool.c