Re: [HACKERS] Fix performance of generic atomics

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: [HACKERS] Fix performance of generic atomics
Дата
Msg-id CA+TgmoY36Rbp5W_1JjFZj1wGhUNUOfgT3qsApEpKK2yKmgdhUw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [HACKERS] Fix performance of generic atomics  (Sokolov Yura <funny.falcon@postgrespro.ru>)
Ответы Re: [HACKERS] Fix performance of generic atomics  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Wed, Sep 6, 2017 at 9:42 AM, Sokolov Yura
<funny.falcon@postgrespro.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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: [HACKERS] PoC plpgsql - possibility to force custom or generic plan
Следующее
От: Jacob Champion
Дата:
Сообщение: Re: [HACKERS] [PATCH] Assert that the correct locks are held whencalling PageGetLSN()