public inbox for [email protected]  
help / color / mirror / Atom feed
From: David Rowley <[email protected]>
To: [email protected]
Subject: pgsql: Refactor AllocSetAlloc(), separating hot and cold paths
Date: Wed, 28 Feb 2024 01:21:19 +0000
Message-ID: <[email protected]> (raw)

Refactor AllocSetAlloc(), separating hot and cold paths

Allocating from a free list or from a block which contains enough space
already, we deem to be common code paths and want to optimize for those.
Having to allocate a new block, either a normal block or a dedicated one
for a large allocation, we deem to be less common, therefore we class
that as "cold".  Both cold paths require a malloc so are going to be
slower as a result of that regardless.

The main motivation here is to remove the calls to malloc() in the hot
path and because of this, the compiler is now free to not bother setting
up the stack frame in AllocSetAlloc(), thus making the hot path much
cheaper.

Author: Andres Freund
Reviewed-by: David Rowley
Discussion: https://postgr.es/m/[email protected]

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/413c18401dcc170636429127e2494d8beba4b92f

Modified Files
--------------
src/backend/utils/mmgr/aset.c | 481 +++++++++++++++++++++++-------------------
1 file changed, 268 insertions(+), 213 deletions(-)



reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: pgsql: Refactor AllocSetAlloc(), separating hot and cold paths
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox