[all-commits] [llvm/llvm-project] 65b136: Default raw_string_ostream to be unbuffered

Benjamin Kramer via All-commits all-commits at lists.llvm.org
Sun Apr 26 03:59:13 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 65b13610a5226b84889b923bae884ba395ad084d
      https://github.com/llvm/llvm-project/commit/65b13610a5226b84889b923bae884ba395ad084d
  Author: Benjamin Kramer <benny.kra at googlemail.com>
  Date:   2020-04-26 (Sun, 26 Apr 2020)

  Changed paths:
    M llvm/include/llvm/Support/raw_ostream.h
    M llvm/unittests/Support/raw_ostream_test.cpp

  Log Message:
  -----------
  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.




More information about the All-commits mailing list