[PATCH] D91693: [Support] Add reserve() method to the raw_ostream.

Alexey Lapshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 18 02:41:08 PST 2020


avl created this revision.
avl added reviewers: jhenderson, alexshap, grimar, labath.
Herald added subscribers: llvm-commits, dexonsmith, hiraditya, mgorny.
Herald added a project: LLVM.
avl requested review of this revision.
Herald added a subscriber: ormris.

If resulting size of the output stream is already known,
then the space for stream data could be preliminary
allocated in some cases. f.e. raw_string_ostream could
preallocate the space for the target string(it allows
to avoid reallocations during writing into the stream).
The raw_fd_ostream could use memory mapped file as
an intermediate buffer, which allows to reduce amount
of copied data. Such behavior could be used to help
refactoring done by D91028 <https://reviews.llvm.org/D91028>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91693

Files:
  llvm/include/llvm/Support/raw_ostream.h
  llvm/lib/Support/raw_ostream.cpp
  llvm/unittests/Support/CMakeLists.txt
  llvm/unittests/Support/raw_fd_ostream_test.cpp
  llvm/unittests/Support/raw_fd_stream_test.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91693.306019.patch
Type: text/x-patch
Size: 22313 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201118/326fa96c/attachment.bin>


More information about the llvm-commits mailing list