[llvm-branch-commits] [libc] Add optimized clang_vector memchr implementation (PR #244469)

Aiden Grossman via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Nov 19 17:03:18 PST 2026


https://github.com/boomanaiden154 created https://github.com/llvm/llvm-project/pull/244469

This patch adds a reasonably optimized clang_vector based memchr
implementation. It is comparable in .text size to glibc and about 30%
faster for inputs <64 bytes (90+% of inputs for server applications). We
lose a little bit for larger inputs due to extra instructions in the
main loop that LLVM isn't able to optimize away, but not by too much.

The original implementatin was written by an agent as I prodded it to
keep making the implementation faster. Then I heavily hand-edited mostly
for style.

Assisted-By: LLM





More information about the llvm-branch-commits mailing list