Re: [PATCH 1/2] lib/string: Improve strstarts() performance
From: Andy Shevchenko
Date: Mon Apr 07 2025 - 09:59:33 EST
On Mon, Apr 07, 2025 at 09:15:04PM +0800, Zijun Hu wrote:
> From: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
>
> strstarts() is frequently invoked to test if a string has another string
> as prefix, but its performance is degraded by the strlen() loop contained.
>
> Improve its performance by eliminating the strlen() loop.
NAK.
First of all, this function is supposed to be run against constant string literals.
Second, this commit message has zero proofs to tell if there is actual performance
downgrage even in the case when prefix is not a constant string literal.
--
With Best Regards,
Andy Shevchenko