Re: Marginal performance improvement for fast-path locking - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Marginal performance improvement for fast-path locking
Date
Msg-id 16685.1385666601@sss.pgh.pa.us
Whole thread Raw
In response to Re: Marginal performance improvement for fast-path locking  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Marginal performance improvement for fast-path locking  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Thu, Nov 28, 2013 at 1:46 PM, Tom Lane <tgl@sss.pgh.pa.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



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Marginal performance improvement for fast-path locking
Next
From: Robert Haas
Date:
Subject: Re: Marginal performance improvement for fast-path locking