VOOZH about

URL: https://www.phoronix.com/news/Linux-7.1-RISC-V-strnlen

⇱ RISC-V Optimized strnlen Implementation For Linux 7.1 Yields Big Speed-Up - Phoronix


👁 Phoronix

RISC-V Optimized strnlen Implementation For Linux 7.1 Yields Big Speed-Up

Written by Michael Larabel in RISC-V on 9 April 2026 at 09:51 AM EDT. 7 Comments
In addition to RISC-V discontinuing its eXecute In Place "XIP" kernel support for Linux 7.1, there is an optimized strnlen() function coming for Linux 7.1 on RISC-V as well as some other optimized functions.

Feng Jiang with KylinOS wrote a hand-optimized strnlen() implementation for RISC-V with both a generic code path and Zbb-powered version. The strnlen() function used throughout the kernel for safely determining the length of a string is seeing a massive speed-up as a result of the hand-optimized RISC-V Assembly code.

👁 RISC-V strnlen benchmark


Benchmarks are showing as much as a +427.5% improvement with the RISC-V optimized strnlen function appearing at long last.

The strnlen optimization patch is queued into the RISC-V's "for-next" Git branch ahead of the Linux 7.1 merge window opening next week.

There is also a RISC-V optimized strchr() function too for up to a 7% improvement for finding the first occurence of the character in a string. And the optimized strrchr() for the reverse searching yielding up to a 8% improvement from that hand-written RISC-V Assembly for the Linux kernel.

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.