[libcxx-commits] [PATCH] D129964: [libc++][format] Improve format buffer.

Victor Zverovich via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jul 27 14:42:43 PDT 2022


vitaut added a comment.

Nice improvement but I'd still recommend exploring direct writes to contiguous containers as discussed on the other diff.



================
Comment at: libcxx/include/__format/buffer.h:89
+  template <__formatter::__char_type _InCharT>
+  _LIBCPP_HIDE_FROM_ABI void __copy(basic_string_view<_InCharT> __str) {
+    // When the underlying iterator is a simple iterator the __capacity_ is
----------------
Why are some member functions like `__copy` mangled while others like `make_output_iterator` are not?


================
Comment at: libcxx/include/__format/buffer.h:225
+  /// Note it would be more efficient to write 500 chars directly and then swap
+  /// the buffers. This would make the code complexer and \ref format_to_n is
+  /// not the most common use case. Therefore the optimization isn't done.
----------------
complexer -> more complex


================
Comment at: libcxx/include/__format/formatter_output.h:96
+_LIBCPP_HIDE_FROM_ABI auto
+__copy(basic_string_view<_CharT> __str, output_iterator<const _OutCharT&> auto __out_it) -> decltype(__out_it) {
+  if constexpr (_VSTD::same_as<decltype(__out_it), _VSTD::back_insert_iterator<__format::__output_buffer<_OutCharT>>>) {
----------------
Why const?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129964/new/

https://reviews.llvm.org/D129964



More information about the libcxx-commits mailing list