Re: Marginal performance improvement for fast-path locking

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Marginal performance improvement for fast-path locking
Date: 2013-11-28 19:23:21
Message-ID: 16685.1385666601@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Thu, Nov 28, 2013 at 1:46 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> We could add an extra test in FastPathGrantRelationLock's loop to make
>> it remember the first unused slot rather than the last one, but that
>> would add some cycles there, partially negating any benefit. Instead
>> I propose that we reverse the direction of the search loop, as attached.

> Well, the reason why the array is only 64 bytes in size is to make
> sure that searching the whole thing is really fast. We figure we're
> going to have to do that often, so it needs to be cheap. If it's not,
> we're hosed already, I think.

I actually suspect the bitmask manipulations cost more than the touches
of fpRelId[]. I agree that there's no reason to think that this area
needs really tense micro-optimization, but if we can get some savings for
zero added cost/complexity, why not?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2013-11-28 19:24:45 Re: Marginal performance improvement for fast-path locking
Previous Message Robert Haas 2013-11-28 19:16:57 Re: Marginal performance improvement for fast-path locking