On Thu, Nov 28, 2013 at 2:23 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 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?
Sure.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company