pgsql: Optimize pg_atomic_exchange_u32 and pg_atomic_exchange_u64.

Поиск
Список
Период
Сортировка
От Nathan Bossart
Тема pgsql: Optimize pg_atomic_exchange_u32 and pg_atomic_exchange_u64.
Дата
Msg-id E1rFGsH-00AnIH-01@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Optimize pg_atomic_exchange_u32 and pg_atomic_exchange_u64.

Presently, all platforms implement atomic exchanges by performing
an atomic compare-and-swap in a loop until it succeeds.  This can
be especially expensive when there is contention on the atomic
variable.  This commit optimizes atomic exchanges on many platforms
by using compiler intrinsics, which should compile into something
much less expensive than a compare-and-swap loop.  Since these
intrinsics have been available for some time, the inline assembly
implementations are omitted.

Suggested-by: Andres Freund
Reviewed-by: Andres Freund
Discussion: https://postgr.es/m/20231129212905.GA1258737%40nathanxps13

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/64b1fb5f03266f0ef4eef3ad2b7d97170bb05b78

Modified Files
--------------
src/include/port/atomics/generic-gcc.h    | 34 +++++++++++++++++++++++++++++++
src/include/port/atomics/generic-msvc.h   | 18 ++++++++++++++++
src/include/port/atomics/generic-sunpro.h | 14 +++++++++++++
3 files changed, 66 insertions(+)


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

Предыдущее
От: Nathan Bossart
Дата:
Сообщение: pgsql: Micro-optimize datum_to_json_internal() some more.
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: compute_bitmap_pages' loop_count parameter should be double not