Default raw_string_ostream to be unbuffered
authorBenjamin Kramer <benny.kra@googlemail.com>
Sun, 26 Apr 2020 10:45:57 +0000 (12:45 +0200)
committerBenjamin Kramer <benny.kra@googlemail.com>
Sun, 26 Apr 2020 10:45:57 +0000 (12:45 +0200)
commit65b13610a5226b84889b923bae884ba395ad084d
tree09a10a894914ce2524d1b4df83497ad13b293daa
parent9caac56a65cfd44a81e873dc7d224c7a996144dd
Default raw_string_ostream to be unbuffered

raw_string_ostream can just use the std::string as a buffer. The buffer
requirement came from the days when the minimum buffer size was 128
(fixed in 2015) and std::string was non-SSO. Now we can just use the
inline capacity for small things and on a good growth strategy later.

This assumes that the standard library isn't doing something bad like
only growing to the exact size. I checked some common implementations
and they grow by 2x (libc++) or 1.5x (msvc) which is reasonable. We
should still check if this incurs any performance regressions though.
llvm/include/llvm/Support/raw_ostream.h
llvm/unittests/Support/raw_ostream_test.cpp