HomeFreeBSD

libc: scalar strlen() in RISC-V assembly

Description

libc: scalar strlen() in RISC-V assembly

Includes a scalar implementation of strlen() for the RISC-V
architecture and changes to the corresponding manpage.

Performance was benchamarked using before and after:
https://github.com/clausecker/strperf

os: FreeBSD
arch: riscv

│ strlen_baseline │             strlen_scalar              │
│     sec/op      │   sec/op     vs base                   │

Short 541.2µ ± 17% 401.6µ ± 0% -25.78% (p=0.000 n=21+20)
Mid 249.6µ ± 3% 191.9µ ± 0% -23.13% (p=0.000 n=21+20)
Long 124.6µ ± 0% 110.7µ ± 0% -11.13% (p=0.000 n=21+20)
geomean 256.3µ 204.3µ -20.26%

│ strlen_baseline │              strlen_scalar               │
│       B/s       │      B/s       vs base                   │

Short 220.3Mi ± 14% 296.8Mi ± 0% +34.74% (p=0.000 n=21+20)
Mid 477.6Mi ± 3% 621.3Mi ± 0% +30.09% (p=0.000 n=21+20)
Long 956.9Mi ± 0% 1076.7Mi ± 0% +12.52% (p=0.000 n=21+20)
geomean 465.2Mi 583.4Mi +25.40%

MFC after: 1 month
MFC to: stable/15
Approved by: mhorne, markj (mentor)
Reviewed by: fuz
Sponsored by: Google LLC (GSoC 2024)
Differential Revision: https://reviews.freebsd.org/D45693

(cherry picked from commit e09c1583eddd345bdb79f3db8a91166f6f139207)

Details

Provenance
strajabotAuthored on May 17 2024, 2:23 PM
fuzCommitted on Sun, Nov 30, 12:43 AM
Reviewer
fuz
Differential Revision
D45693: libc: scalar strlen() in RISC-V assembly
Parents
rG62fa1d20fec7: simd.7: add scalar memset() for RISC-V to manpage
Branches
Unknown
Tags
Unknown