From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Sokolov Yura <funny(dot)falcon(at)postgrespro(dot)ru> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Jesper Pedersen <jesper(dot)pedersen(at)redhat(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, pgsql-hackers-owner(at)postgresql(dot)org |
Subject: | Re: Fix performance of generic atomics |
Date: | 2017-09-06 15:35:00 |
Message-ID: | CA+TgmoY36Rbp5W_1JjFZj1wGhUNUOfgT3qsApEpKK2yKmgdhUw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Sep 6, 2017 at 9:42 AM, Sokolov Yura
<funny(dot)falcon(at)postgrespro(dot)ru> wrote:
> Yes, you're right.
>
> But I think, generic version still should be "fixed".
> If generic version is not reached on any platform, then why it is kept?
> If it is reached somewhere, then it should be improved.
This seems like a pretty sound argument to me. I think Tom's probably
right that the changes in generic-gcc.h are the important ones, but
I'm not sure that's an argument against patching generics.h. Given
that pg_atomic_compare_exchange_u32_impl is defined to update *old
there seems to be no reason to call pg_atomic_read_u32_impl every time
through the loop. Whether doing so hurts performance in practice is
likely to depend on a bunch of stuff, but we don't normally refuse to
remove unnecessary code on the grounds that it will rarely be reached.
Given that CPUs are weird, it's possible that there is some system
where throwing an extra read of a value we already have into the loop
works out to a win, but in the absence of evidence I'm reluctant to
presume it.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Jacob Champion | 2017-09-06 15:37:53 | Re: [PATCH] Assert that the correct locks are held when calling PageGetLSN() |
Previous Message | Robert Haas | 2017-09-06 15:17:23 | Re: PoC plpgsql - possibility to force custom or generic plan |