Re: Use gcc built-in atomic inc/dec in lock.c - Mailing list pgsql-hackers

From Mikko Tiihonen
Subject Re: Use gcc built-in atomic inc/dec in lock.c
Date
Msg-id 50CB46B1.9090700@nitorcreations.com
Whole thread Raw
In response to Re: Use gcc built-in atomic inc/dec in lock.c  (Peter Geoghegan <peter@2ndquadrant.com>)
Responses Re: Use gcc built-in atomic inc/dec in lock.c  (Merlin Moncure <mmoncure@gmail.com>)
Re: Use gcc built-in atomic inc/dec in lock.c  (Любен Каравелов <karavelov@mail.bg>)
List pgsql-hackers
On 12/13/2012 12:19 AM, Peter Geoghegan wrote:
> On 12 December 2012 22:11, Mikko Tiihonen
> <mikko.tiihonen@nitorcreations.com> wrote:
>> noticed a "XXX: It might be worth considering using an atomic fetch-and-add
>> instruction here, on architectures where that is supported." in lock.c
>>
>> Here is my first try at using it.
>
> That's interesting, but I have to wonder if there is any evidence that
> this *is* actually helpful to performance.

One of my open questions listed in the original email was request for help on
creating a test case that exercise the code path enough so that it any
improvements can be measured.

But apart from performance I think there are two other aspects to consider:
1) Code clarity: I think the lock.c code is easier to understand after the patch
2) Future possibilities: having the atomic_inc/dec generally available allows   other performance critical parts of
postgrestake advantage of them in the   future
 

-Mikko



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Assert for frontend programs?
Next
From: "Karl O. Pinc"
Date:
Subject: Re: Doc patch to note which system catalogs have oids