[llvm] [llvm-strings] Use small buffer instead of reading whole file (PR #163073)

Harald van Dijk via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 9 04:33:36 PDT 2026


hvdijk wrote:

This may be an improvement for when the input is a pipe, but the current implementation uses `mmap` where possible and if I'm looking at this PR right, your replacement never does, so I would expect it to impact performance for that case. Can you either run measurements and show that this case is not significantly affected, or change the PR to continue first trying to use `mmap`, only falling back to processing the input in chunks if `mmap` fails?

It'll need a bit of thinking on how this interacts with #221794 when a multibyte character spans multiple chunks. `std::codecvt_base::result` does not distinguish between the case where the source buffer ends unexpectedly and the case where the target buffer is not large enough, but these will require different treatment. I'll have a think but I'd welcome your thoughts on that as well.

https://github.com/llvm/llvm-project/pull/163073


More information about the llvm-commits mailing list