heapgettup refactoring

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Andres Freund <andres(at)anarazel(dot)de>
Subject: heapgettup refactoring
Date: 2022-10-31 18:37:39
Message-ID: CAAKRu_YSOnhKsDyFcqJsKtBSrd32DP-jjXmv7hL0BPD-z0TGXQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Attached is a patchset to refactor heapgettup(), heapgettup_pagemode(),
and heapgetpage(). heapgettup() and heapgettup_pagemode() have a lot of
duplicated code, confusingly nested if statements, and unnecessary local
variables. While working on a feature for the AIO/DIO patchset, I
noticed that it was difficult to add new code to heapgettup() and
heapgettup_pagemode() because of how the functions are written.

I've taken a stab at refactoring them -- without generating less
efficient code or causing regressions. I'm interested if people find it
more readable and if those with more assembly expertise see issues (new
branches added which are not highly predictable, etc). I took a look at
the assembly for those symbols compiled at O2 but am not experienced
enough at analysis to come to any conclusions.

- Melanie

Attachment Content-Type Size
v1-0002-Turn-HeapKeyTest-macro-into-function.patch application/octet-stream 3.6 KB
v1-0001-Remove-breaks-in-HeapTupleSatisfiesVisibility.patch application/octet-stream 1.4 KB
v1-0003-Refactor-heapgettup-and-heapgetpage.patch application/octet-stream 28.6 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2022-10-31 18:40:28 Re: heavily contended lwlocks with long wait queues scale badly
Previous Message Matthias van de Meent 2022-10-31 18:14:08 Re: Improving btree performance through specializing by key shape, take 2