Landing: 0876c8b7f4ed

Project / Subsystem

gcc / libstdc++

Date

2026-07-16

Author

Anlai Lu

Commit

0876c8b7f4ed876e2beba17bc91438934543896b

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
libstdc++
patch_id
—
commit_hash
0876c8b7f4ed876e2beba17bc91438934543896b
source_type
github
headline
libstdc++: Specialize _Iter_sink for ostreambuf_iterator
tldr
Optimizes formatting to `std::ostreambuf_iterator` by specializing `_Iter_sink` for bulk writes.
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 optimizes the formatting library in libstdc++ by adding a partial specialization of _Iter_sink for std::ostreambuf_iterator. This specialization leverages bulk sputn writes and zero-copy put-area operations, replacing per-character sputc calls. It ensures that all counting and truncation logic is handled within the specialization, allowing the base _Streambuf_sink to remain a pure I/O layer and enabling accurate calculation of total output length.