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

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 9288645b596efde3a58e267896b38f8f089a2920
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2015-03-16T03:22:03Z
Releases: 9.1.16
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.

Files

PathChange+/−
contrib/intarray/_int_tool.c modified +23 −29