[llvm] [llvm-strings] Add --encoding={s,S,utf8} option (PR #221794)

Harald van Dijk via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 4 14:25:22 PDT 2026


hvdijk wrote:

> I was expecting it to be slower, that's fine if it's necessary to get the right results, but at the moment it's almost 15x slower and that's worse than I was expecting. I should be able to speed it up somewhat [...] by also doing the conversion in chunks.

After switching to using the C API directly, doing the conversion in chunks no longer gave a big improvement, and complicated the code significantly, so I have kept that out of what I pushed.

> I think this is unavoidable without dropping the C++ API and using the C API directly, which I should be able to try tomorrow.

This is now in this PR, and gave about a 50% speed boost over using the C++ API from the previous version of this PR. It's still significantly slower than the `-e s` case, but I'm not expecting the typical use of this to be to run it on multi-gigabyte files, and I'm not seeing any other obvious points where speed can be improved, so hopefully it's fast enough.

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


More information about the llvm-commits mailing list