Re: Sort functions with specialized comparators

Nathan Bossart <nathandbossart@gmail.com>

From: Nathan Bossart <nathandbossart@gmail.com>
To: John Naylor <johncnaylorls@gmail.com>
Cc: "Andrey M. Borodin" <x4mmm@yandex-team.ru>, David Rowley <dgrowleyml@gmail.com>, Антуан Виолин <violin.antuan@gmail.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2025-01-06T17:47:52Z
Lists: pgsql-hackers
On Mon, Jan 06, 2025 at 05:54:29PM +0700, John Naylor wrote:
> Those functions from common/int.h are probably not good when inlined
> (see comment there).

+1.  In fact, I think this comment was added because of the ST_MED3()
function in sort_template.h [0].  IIRC clang handles this just fine, but
gcc does not.

[0] https://postgr.es/m/20240212230423.GA3519%40nathanxps13

-- 
nathan



Commits

  1. Specialize intarray sorting

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