This is v3 of the patch series. Performance data: see v2 cover letter.
Results are unchanged -- same stack-buffer + __ostream_insert approach.
Patch 1 is unchanged from v2.
Changes in Patch 2 from v2:
- Dropped the format string parameter from __chrono_write.
_S_empty_fs() is used directly, per Tomasz Kaminski's suggestion.
All chrono types now share the same two call forms:
__detail::__chrono_write(__os, __arg);
__detail::__chrono_write(__os, __arg, __os.getloc());
- Removed __detail::__empty_fmt: no longer needed.
- All remaining operator<< that used basic_stringstream now use
__chrono_write (month_day, month_day_last, month_weekday,
month_weekday_last, year_month, year_month_day_last,
year_month_weekday, year_month_weekday_last, sys_days, local_time).
- The only types not converted: duration (must forward stream flags
and precision) and local_info (uses __formatter_chrono_info).
- Uses std::format_to_n (public API) instead of __do_vformat_to_n.
Tested on x86_64-linux-gnu. libstdc++ testsuite (std/time/*) clean.
All converted types verified byte-identical across C, en_US, de_DE,
fr_FR, and zh_CN locales.
Anlai Lu (2):
libstdc++: Add stream state tests for chrono operator<<
libstdc++: Use __chrono_write via _S_empty_fs for chrono ostream
insertion
libstdc++-v3/include/bits/chrono_io.h | 227 ++++--------------
.../testsuite/std/time/ostream_insert.cc | 163 +++++++++++++
2 files changed, 212 insertions(+), 178 deletions(-)
create mode 100644 libstdc++-v3/testsuite/std/time/ostream_insert.cc
--
2.34.1