Abstract:As a lightweight standard C library, musl libc features a small code base providing comprehensive POSIX interface support, and high portability and support for various architectures and operating systems. It is widely employed in embedded systems, Web servers, containers, and other fields. RISC-V instruction set is an open source instruction set that has released the relatively stable SIMD instruction set at present. Meanwhile, the RISC-V ecological software environment has ushered in a new optimization boom, but the RVV extension optimization of the musl libc library is still a research gap. Based on the collaborative research of the musl libc basic library and RISC-V RVV extended instruction set, this study proposes an implementation scheme compatible with the basic instruction set and vector extended instruction set. The common C library functions strlen and memset are optimized by the vector extended instruction set, and comparative analysis is carried out on gem5 simulator. The experimental results show that compared with the implementation of C language, the performance of strlen function optimized by RVV is improved by 83%–703% on average, and that of memset function is improved by 85%–334% on average.