Re: [PATCH] Precompute string lengths in PerformRadiusTransaction

From: Aleksander Alekseev <aleksander(at)tigerdata(dot)com>
To: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: zengman <zengman(at)halodbtech(dot)com>
Subject: Re: [PATCH] Precompute string lengths in PerformRadiusTransaction
Date: 2026-01-05 14:51:58
Message-ID: CAJ7c6TNEU+hVAysAQL_2wQizzp6DTWg07FT68XAAJ6i2NsUNdw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

> I noticed that the `PerformRadiusTransaction` function is invoked in a loop,
> and the function itself contains internal loops that repeatedly call strlen() on the 'passwd' and 'secret' strings.
> While the optimization gain may be minimal, I still think it’s worth making the change —
> we can precompute the lengths of these two strings at the start of the function to eliminate redundant strlen() calls.

Good find. We may also consider making both passwd_len and secret_len `const`.

--
Best regards,
Aleksander Alekseev

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Antonin Houska 2026-01-05 14:59:32 Re: Adding REPACK [concurrently]
Previous Message Álvaro Herrera 2026-01-05 14:38:59 Re: [PATCH} Move instrumentation structs