Skip site navigation (1) Skip section navigation (2)

Re: Avoiding repeated snapshot computation

From: Ants Aasma <ants(dot)aasma(at)eesti(dot)ee>
To: Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Avoiding repeated snapshot computation
Date: 2011-11-30 00:03:23
Message-ID: CA+CSw_u1Pv37wn8ovfH0D3yq8dsXV1qxrfzJqPzE1H3G3hXKPQ@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On Tue, Nov 29, 2011 at 7:12 AM, Pavan Deolasee
<pavan(dot)deolasee(at)gmail(dot)com> wrote:
> I think that a good idea. We need a representation that needs minimum
> processing to derive the snapshot.

I was looking over the generated code for GetSnapshotData to see if there
is any low hanging fruit for micro-optimization. The assembly mostly looks
pretty tight, but there are 3 function calls to TransactionIdPrecedes and
TransactionIdFollowsOrEquals. All the parameters are known to be normal
xids, so there are duplicated checks for that and a lot of movs for the calling
convention. I wonder if replacing them with special case macros would be
a good idea. In that case the whole check will compile down to one cmp
instruction. I'm running a set of benchmarks now on my laptop, but I guess
the difference will mostly become noticeable on beefier hardware when
ProcArray lock is heavily contended. Attached is a patch, if anyone wishes
to give it a go.

--
Ants Aasma

Attachment: opt-snapshot-txcmp.patch
Description: text/x-patch (1.6 KB)

In response to

pgsql-hackers by date

Next:From: Tom LaneDate: 2011-11-30 00:04:23
Subject: Re: autovacuum and default_transaction_isolation
Previous:From: Tom LaneDate: 2011-11-29 22:12:11
Subject: Re: Patch - Debug builds without optimization

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group