Linux likely() unlikely() for PostgreSQL

From: wenhui qiu <qiuwenhuifx(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Linux likely() unlikely() for PostgreSQL
Date: 2024-06-30 13:55:39
Message-ID: CAGjGUAKTON7s20zBxzn+SMAM-Ruv-kR17CsuM9uEmGebfh5igA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Hackers
When I saw this document:https://en.wikipedia.org/wiki/Branch_predictor,
I thought of Linux likely() vs unlikely() and thus thought that there are
some code segments in src/backend/executor/execMain.c that can be optimized.
For example :
if (ExecutorStart_hook)
(*ExecutorStart_hook) (queryDesc, eflags);
else
standard_ExecutorStart(queryDesc, eflags);
}
void
ExecutorRun(QueryDesc *queryDesc,
ScanDirection direction, uint64 count,
bool execute_once)
{
if (ExecutorRun_hook)
(*ExecutorRun_hook) (queryDesc, direction, count, execute_once);
else
standard_ExecutorRun(queryDesc, direction, count, execute_once);
}
###
if (unlikely(ExecutorRun_hook)),

I hope to get guidance from community experts,Many thanks

Thanks

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthias van de Meent 2024-06-30 14:47:02 Re: Linux likely() unlikely() for PostgreSQL
Previous Message Pavel Stehule 2024-06-30 13:48:35 Re: Extension using Meson as build system