Landing: dc6b71d23465

Project / Subsystem

gcc / gimple-fold

Date

2026-08-15

Author

Kyrylo Tkachov

Commit

dc6b71d23465f237165050bc30c4e038c602a2d7

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
gimple-fold
patch_id
—
commit_hash
dc6b71d23465f237165050bc30c4e038c602a2d7
source_type
github
headline
Fold fwrite of a single byte to fputc for performance.
tldr
Optimizes single-byte `fwrite` calls to `fputc`, improving performance in applications like `jq`.
author
Kyrylo Tkachov
outcome
committed
performance_win
true
breaking_change
false
series_id
—
series_parts
[]
tags
  • • optimization
  • • performance
  • • stdio
discussion_id_link
—
bugzilla_pr
—
date
2026-08-15T00:00:00.000Z

This commit introduces a new GIMPLE pass to fold fwrite(p, 1, 1, f) calls into fputc(*p, f). This optimization is beneficial because fputc writes directly to the stream, bypassing fwrite’s buffered-write path. Benchmarks with jq show significant reductions in instructions and cycles, particularly when processing large datasets.