pgsql: Only clear latch self-pipe/event if there is a pending notificat - Mailing list pgsql-committers

From Andres Freund
Subject pgsql: Only clear latch self-pipe/event if there is a pending notificat
Date
Msg-id E1agzUL-0007T0-W0@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Only clear latch self-pipe/event if there is a pending notification.

This avoids a good number of, individually quite fast, system calls in
scenarios with many quick queries. Besides the aesthetic benefit of
seing fewer superflous system calls with strace, it also improves
performance by ~2% measured by pgbench -M prepared -c 96 -j 8 -S (scale
100).

Without having benchmarked it, this patch also adjust the windows code,
as that makes it easier to unify the unix/windows codepaths in a later
patch. There's little reason to diverge in behaviour between the
platforms.

Discussion: CA+TgmoYc1Zm+Szoc_Qbzi92z2c1vRHZmjhfPn5uC=w8bXv6Avg@mail.gmail.com
Reviewed-By: Robert Haas

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/c4901a1e03a7730e4471fd1143f1caf79695493d

Modified Files
--------------
src/backend/port/unix_latch.c  | 81 ++++++++++++++++++++++++++++--------------
src/backend/port/win32_latch.c | 19 +++++-----
2 files changed, 65 insertions(+), 35 deletions(-)


pgsql-committers by date:

Previous
From: Andres Freund
Date:
Subject: pgsql: Remove unused, and dangerous, TestLatch() macro.
Next
From: Andres Freund
Date:
Subject: pgsql: Error out if waiting on socket readiness without a specified soc