From: | John Naylor <johncnaylorls(at)gmail(dot)com> |
---|---|
To: | "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru> |
Cc: | David Rowley <dgrowleyml(at)gmail(dot)com>, Антуан Виолин <violin(dot)antuan(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Sort functions with specialized comparators |
Date: | 2024-12-05 10:16:06 |
Message-ID: | CANWCAZYjEndXeqyT9Wvnbkx1f0ayv4JJ-DHd0u_0QOYVNiYiJA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Dec 4, 2024 at 2:47 PM Andrey M. Borodin <x4mmm(at)yandex-team(dot)ru> wrote:
> sort_int32_cmp Time: 543.690 ms
> sort_int32_cmp_2 Time: 609.019 ms
> sort_int32_cmp_4 Time: 612.219 ms
>
> So, I'd stick with sort_int32_cmp. But, perhaps, on Intel we might have different results.
I tried on an older Intel chip and got similar results, so we'll go
with your original comparator:
master: latency average = 1867.878 ms
cmp1: latency average = 1189.225 ms
cmp2: latency average = 1341.153 ms
cmp3: latency average = 1270.053 ms
I believe src/port/qsort.c was meant to be just for the standard sort
interface as found in a C library. We do have one globally visible
special sort here:
src/backend/utils/sort/qsort_interruptible.c
...so that directory seems a better fit. The declaration is in
src/include/port.h, though. Note: that one doesn't have a global
wrapper around a static function -- it's declared global since
ST_SCOPE is not defined.
And one more bikeshedding bit that might get noticed: tuplesorts
express their boolean as "reversed". We don't necessarily need to
follow that, but consistency is good for readability.
--
John Naylor
Amazon Web Services
From | Date | Subject | |
---|---|---|---|
Next Message | John Naylor | 2024-12-05 10:36:43 | Re: CSN snapshots in hot standby |
Previous Message | Amit Kapila | 2024-12-05 10:00:29 | Re: Conflict detection for update_deleted in logical replication |