Re: Avoid stack frame setup in performance critical routines using tail calls

From: Andres Freund <andres(at)anarazel(dot)de>
To: David Rowley <dgrowleyml(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org, Robert Haas <robertmhaas(at)gmail(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Tomas Vondra <tv(at)fuzzy(dot)cz>
Subject: Re: Avoid stack frame setup in performance critical routines using tail calls
Date: 2023-07-19 08:52:36
Message-ID: 20230719085236.jltxal2eztqrprfg@awork3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

David and I were chatting about this patch, in the context of his bump
allocator patch. Attached is a rebased version that is also split up into two
steps, and a bit more polished.

I wasn't sure what a good test was. I ended up measuring
COPY pgbench_accounts TO '/dev/null' WITH (FORMAT 'binary');
of a scale 1 database with pgbench:

c=1;pgbench -q -i -s1 && pgbench -n -c$c -j$c -t100 -f <(echo "COPY pgbench_accounts TO '/dev/null' WITH (FORMAT 'binary');")

average latency
HEAD: 33.865 ms
01: 32.820 ms
02: 29.934 ms

The server was pinned to the one core, turbo mode disabled. That's a pretty
nice win, I'd say. And I don't think this is actually the most allocator
bound workload, I just tried something fairly random...

Greetings,

Andres Freund

Attachment Content-Type Size
v2-0001-Optimize-palloc-etc-to-allow-sibling-calls.patch text/x-diff 21.5 KB
v2-0002-Optimize-AllocSetAlloc-by-separating-hot-from-col.patch text/x-diff 16.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2023-07-19 09:16:44 Re: Use of additional index columns in rows filtering
Previous Message Ashutosh Bapat 2023-07-19 08:39:30 Re: unrecognized node type while displaying a Path due to dangling pointer