Re: [PATCH v3 7/8] riscv: lib: add strchr implementation

Andy Shevchenko
2026-01-20T07:32:04Z

On Tue, Jan 20, 2026 at 02:58:51PM +0800, Feng Jiang wrote:
> Add an assembly implementation of strchr() for RISC-V.
>
> By eliminating stack frame management (prologue/epilogue) and optimizing
> the function entries, the assembly version provides significant relative
> gains for short strings where the fixed overhead of the C function is
> most prominent. As the string length increases, the performance converges
> with the byte-oriented scan logic.
>
> Benchmark results (QEMU TCG, rv64):
> Length | Original (MB/s) | Optimized (MB/s) | Improvement
> -------|-----------------|------------------|------------
> 1 B | 21 | 23 | +9.5%
> 7 B | 118 | 126 | +6.7%
> 16 B | 200 | 208 | +4.0%
> 512 B | 375 | 399 | +6.4%
> 4096 B | 395 | 401 | +1.5%

> Suggested-by: Andy Shevchenko <andy@kernel.org>

Wrong tag.

--
With Best Regards,
Andy Shevchenko