[pgpool-hackers: 4599] Porting likely/unlikely
Tatsuo Ishii
ishii at postgresql.org
Wed May 28 11:49:39 JST 2025
Long time ago PostgreSQL has started to use likely/unlikely macros,
that give a hint to GNU C compiler.
commit aa3ca5e3dd60bf0b992b74f955378f28e601292a
Author: Andres Freund <andres at anarazel.de>
Date: Fri Oct 14 16:05:30 2016 -0700
Add likely/unlikely() branch hint macros.
These are useful for very hot code paths. Because it's easy to guess
wrongly about likelihood, and because such likelihoods change over time,
they should be used sparingly.
Past tests have shown it'd be a good idea to use them in some places,
e.g. in error checks around ereports that ERROR out, but that's work for
later.
Discussion: <20160727004333.r3e2k2y6fvk2ntup at alap3.anarazel.de>
I think these macros are not only useful to enhance performance (if
correctly used) but make porting codes from PostgreSQL to pgpool
easier since the macros occasionally used in the code. Attached is the
patch to implement likely/unlikely in pgpool.
Best regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: likely.patch
Type: application/octet-stream
Size: 758 bytes
Desc: not available
URL: <http://www.pgpool.net/pipermail/pgpool-hackers/attachments/20250528/325e2277/attachment.obj>
More information about the pgpool-hackers
mailing list