Обсуждение: [PATCH] Precompute string lengths in PerformRadiusTransaction

Поиск
Список
Период
Сортировка

[PATCH] Precompute string lengths in PerformRadiusTransaction

От
"zengman"
Дата:
Hi, hackers

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.

--
Regards,
Man Zeng
www.openhalo.org
Вложения

Re: [PATCH] Precompute string lengths in PerformRadiusTransaction

От
Aleksander Alekseev
Дата:
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



Re: [PATCH] Precompute string lengths in PerformRadiusTransaction

От
"zengman"
Дата:
> Good find. We may also consider making both passwd_len and secret_len `const`.
Thanks ! — Added const for passwd_len and secret_len.

--
Regards,
Man Zeng
www.openhalo.org
Вложения