[libcxx-commits] [libcxx] [libc++] Optimize standard streams with sync_with_stdio(false) (PR #209161)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jul 15 04:49:39 PDT 2026


philnik777 wrote:

> Minor comments, basically LGTM.
> 
> Committing a benchmark for this is quite difficult with our current `.bench.cpp` setup, so I think I'm satisfied if we just confirm that we get a speedup in the case reported in #21566.

I've just tested the code with this patch and `sync_with_stdio(false/true)` (using a random file on my system):

`sync_with_stdio(true)`:
real	0m0,390s
user	0m0,386s
sys	0m0,020s

`sync_with_stdio(false)`:
real	0m0,024s
user	0m0,017s
sys	0m0,016s

With libstdc++ and `sync_with_stdio(false)`:
real	0m0,018s
user	0m0,011s
sys	0m0,012s

Also, for comparison `wc -l`:
real	0m0,008s
user	0m0,000s
sys	0m0,008s

Looks like we still have some way to go to get to `wc` performance, but now we're at least getting somewhat close.



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


More information about the libcxx-commits mailing list