[libcxx-commits] [libcxx] [libc++] Add build flags to optimize <format> and <charconv> for code size. (PR #98003)
Robbie Litchfield via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jul 10 00:45:41 PDT 2024
================
@@ -250,29 +250,79 @@ class __basic_format_arg_value {
__handle __handle_;
};
+ // Visiting a value for formatting is dispatched via a function pointer to prevent
+ // unused formatters from being instantiated. This can lead to significant code size
+ // reductions on statically linked targets esp. at lower optimization levels.
+
+ void (__basic_format_arg_value::*__format_)(
+ basic_format_parse_context<_CharT>& __parse_ctx, _Context& __ctx, bool __parse) const;
----------------
BlamKiwi wrote:
What form would you like the numbers in? e.g., original code is this size/performance vs various tweaks with this size/performance.
I will isolate each change as its own build flag so we can properly analyze its overhead. I know you have existing benchmarks but I will use a simple timing loop instead to better isolate changes.
https://github.com/llvm/llvm-project/pull/98003
More information about the libcxx-commits
mailing list