pgsql: Replace insertion sort in contrib/intarray with qsort().
pgsql: Replace insertion sort in contrib/intarray with qsort().
От:
Tom 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_0_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/40b0c10b763dfe4d6b171a58a2bd49cc3f880087 Modified Files -------------- contrib/intarray/_int_tool.c | 51 +++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 26 deletions(-)