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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Replace insertion sort in contrib/intarray with qsort().
Дата
Msg-id E1YXLbl-0008Hv-1p@gemulon.postgresql.org
обсуждение исходный текст
Список 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
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/8d1f239003d0245dda636dfa6cf0add13bee69d6

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


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Replace insertion sort in contrib/intarray with qsort().
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Replace insertion sort in contrib/intarray with qsort().