From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Improve sift up/down code in binaryheap.c and logtape.c. |
Date: | 2021-12-14 18:35:28 |
Message-ID: | E1mxCe8-00069C-Cm@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Improve sift up/down code in binaryheap.c and logtape.c.
Borrow the logic that's long been used in tuplesort.c: instead
of physically swapping the data in two heap entries, keep the
value that's being sifted up or down in a local variable, and
just move the other values as necessary. This makes the code
shorter as well as faster. It's not clear that any current
callers are really time-critical enough to notice, but we
might as well code heap maintenance the same way everywhere.
Ma Liangzhu and Tom Lane
Discussion: https://postgr.es/m/17336-fc4e522d26a750fd@postgresql.org
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/a2ff18e89ff8f29677084bffd1e3de9ca6cd7224
Modified Files
--------------
src/backend/lib/binaryheap.c | 70 +++++++++++++++++++++++-----------------
src/backend/utils/sort/logtape.c | 54 +++++++++++++------------------
2 files changed, 63 insertions(+), 61 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2021-12-14 22:09:26 | pgsql: Remove pg_dump/pg_dumpall support for dumping from pre-9.2 serve |
Previous Message | Tom Lane | 2021-12-14 16:47:03 | pgsql: Fix datatype confusion in logtape.c's right_offset(). |