Landing: d9b799e27aa3
Project / Subsystem
gcc / libstdc++
Date
2026-07-16
Author
Anlai Lu
Commit
d9b799e27aa3cb7d93ccaa7c6a64663f4c457deb
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- libstdc++
- patch_id
- —
- commit_hash
- d9b799e27aa3cb7d93ccaa7c6a64663f4c457deb
- source_type
- github
- headline
- libstdc++: Add _Streambuf_sink for direct streambuf formatting
- tldr
- Introduces `_Streambuf_sink` for efficient direct formatting to `std::basic_streambuf`.
- author
- Anlai Lu
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • libstdc++
- • formatting
- • optimization
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-07-16T00:00:00.000Z
This commit introduces a new class, _Streambuf_sink, to libstdc++‘s formatting library. This class enables direct writing to std::basic_streambuf using sputn, prioritizing zero-copy writes into the streambuf’s put area. It also incorporates internal tracking of I/O errors to ensure that format-phase exceptions propagate correctly without setting badbit prematurely. The sink is specialized for char_traits<_CharT> to guarantee the presence of the __safe_pbump member.