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

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 16 01:09:39 PDT 2025


jh7370 wrote:

> Notice that the first implementation calls strings() only once so it can be inlined.

Without seeing your code, I can't see what's going on, but I wouldn't expect there to be a need to call `strings` more than once... Anyway, the inlining is unlikely to be the culprit for the performance difference in this case.

> It seems that istream::get has a very huge delay on output. I am not sure where is the bug or is an intended behavior. I am using FreeBSD-Current so that I use the libcxx instead of libstdcxx.

Are you sure you're blaming the right function (keeping in mind that inlining is potentially going on)? I note that the flame graph has cut off the names of most of the functions, so I can't really see the detail. More useful would be looking at a line-by-line breakdown of the `get` method, i.e. something that shows where the time is spent within the function. You can find the current `get` source code at https://github.com/llvm/llvm-project/blob/cf55dfbc5a73d584bab468229a96c63fa7de1f6e/libcxx/include/istream#L664, though it may not exactly match the version you did. You might also want to reach out to the libc++ developers for help figuring out why there's a performance difference.

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


More information about the llvm-commits mailing list