[libcxx-commits] [PATCH] D112361: [libc++][format] Buffer changes proof-of-concept

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Oct 23 04:41:22 PDT 2021


Mordante created this revision.
Mordante requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

In D110495 <https://reviews.llvm.org/D110495> @vitaut suggested a different approach for the buffers. This is
a proof-of-concept of that idea.

- There's a new `__output_buffer` that contains the fixed size buffer. The `__iterator_wrapper_buffer` now always call the `put` of this buffer. When the buffer is full the buffer calls `flush` of one of the original buffers.
- The original buffers are still called buffer, but they're no longer buffers; they are more a write policy. This needs to be renamed once backported.
- All format functions call `__output_buffer:;flush()`. It would be possible to do that with an RAII buffer, but since `flush` then throw from the destructor some guards were needed. This slowed the performance.
- There are before and after benchmark timings using D110501 <https://reviews.llvm.org/D110501> Before -> D110500 <https://reviews.llvm.org/D110500> After -> This patch. In general this approach seems to be an improvement. The notable exception is when using `std::list::begin()` as iterator. This hasn't been investigated, since I don't expect this to be used in real applications.
- This patch is just for discussion, the code is not ready for review and should be folded back in the earlier patches in this series. Especially the two objects called buffer should be changed.

Depends on D110500 <https://reviews.llvm.org/D110500>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112361

Files:
  libcxx/after/format.txt
  libcxx/after/format_to.txt
  libcxx/after/format_to_n.txt
  libcxx/after/formatted_size.txt
  libcxx/before/format.txt
  libcxx/before/format_to.txt
  libcxx/before/format_to_n.txt
  libcxx/before/formatted_size.txt
  libcxx/include/__format/buffer.h
  libcxx/include/format

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112361.381725.patch
Type: text/x-patch
Size: 225012 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211023/4d5b9ce1/attachment-0001.bin>


More information about the libcxx-commits mailing list