pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Micro-optimize GenericXLogFinish().
Date: Sat, 09 Apr 2016 23:31:10 +0000
Message-ID: <E1ap2LO-0007CY-UZ@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Micro-optimize GenericXLogFinish().

Make the inner comparison loops of computeDelta() as tight as possible by
pulling considerations of valid and invalid ranges out of the inner loops,
and extending a match or non-match detection as far as possible before
deciding what to do next.  To keep this tractable, give up the possibility
of merging fragments across the pd_lower to pd_upper gap.  The fraction of
pages where that could happen (ie, there are 4 or fewer bytes in the gap,
*and* data changes immediately adjacent to it on both sides) is too small
to be worth spending cycles on.

Also, avoid two BLCKSZ-length memcpy()s by computing the delta before
moving data into the target buffer, instead of after.  This doesn't save
nearly as many cycles as being tenser about computeDelta(), but it still
seems worth doing.

On my machine, this patch cuts a full 40% off the runtime of
contrib/bloom's regression test.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/68689c66efcda6f217119432edfbdf95a50b26e2

Modified Files
--------------
src/backend/access/transam/generic_xlog.c | 218 +++++++++++++++++++-----------
1 file changed, 138 insertions(+), 80 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Message-ID: <E1ap2LO-0007CY-UZ@gemulon.postgresql.org>
Permalink:  ../E1ap2LO-0007CY-UZ@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ap2LO-0007CY-UZ@gemulon.postgresql.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Micro-optimize GenericXLogFinish().
  In-Reply-To: <E1ap2LO-0007CY-UZ@gemulon.postgresql.org>
  References: <E1ap2LO-0007CY-UZ@gemulon.postgresql.org>

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

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