Avoid is possible a expensive function call (src/backend/utils/adt/varlena.c)

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Avoid is possible a expensive function call (src/backend/utils/adt/varlena.c)
Date: 2024-03-04 17:39:02
Message-ID: CAEudQAqL1x5GWXoRbHvAfqghNrVgVaeDX809p1X9p5RHchYfwA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

The function var_strcmp is a critical function.
Inside the function, there is a shortcut condition,
which allows for a quick exit.

Unfortunately, the current code calls a very expensive function beforehand,
which if the test was true, all the call time is wasted.
So, IMO, it's better to postpone the function call until when it is
actually necessary.

best regards,
Ranier Vilela

Attachment Content-Type Size
avoid-call-expensive-function-varlena.patch application/octet-stream 842 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthias van de Meent 2024-03-04 17:54:32 Re: Avoid is possible a expensive function call (src/backend/utils/adt/varlena.c)
Previous Message Alvaro Herrera 2024-03-04 17:36:55 Re: pgsql: Improve performance of subsystems on top of SLRU