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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Replace insertion sort in contrib/intarray with qsort().
Date: 2015-03-16 03:22:25
Message-ID: E1YXLbl-0008I5-2l@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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_1_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/9288645b596efde3a58e267896b38f8f089a2920

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

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2015-03-16 15:07:13 pgsql: Support opfamily members in get_object_address
Previous Message Tom Lane 2015-03-15 22:41:53 pgsql: Improve representation of PlanRowMark.