]> 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)
commit40b0c10b763dfe4d6b171a58a2bd49cc3f880087
tree4ed9c983744c496f9d3b2bbf51da4db304ebe91e
parent396ef6fd8de2222cb8151e0da8710fd42514e5c2
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