[llvm-branch-commits] [libcxx] [libc++][format][3/7] Improves std::format performance. (PR #101817)

Mark de Wever via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Aug 3 04:32:16 PDT 2024


================
@@ -58,23 +58,156 @@ namespace __format {
 /// This helper is used together with the @ref back_insert_iterator to offer
 /// type-erasure for the formatting functions. This reduces the number to
 /// template instantiations.
+///
+/// The design of the class is being changed to improve performance and do some
+/// code cleanups.
+/// The original design (as shipped up to LLVM-19) uses the following design:
+/// - There is an external object that connects the buffer to the output.
+/// - The class constructor stores a function pointer to a grow function and a
+///   type-erased pointer to the object that does the grow.
+/// - When writing data to the buffer would exceed the external buffer's
+///   capacity it requests the external buffer to flush its contents.
----------------
mordante wrote:

Note the last patch in the series will remove this comment.
The implementation itself is in a transition state too, this also will be cleaned in the final patch of the series.

https://github.com/llvm/llvm-project/pull/101817


More information about the llvm-branch-commits mailing list