Landing: ded7c4e85122

Project / Subsystem

gcc / libstdc++

Date

2026-09-22

Author

Tamar Christina

Commit

ded7c4e851228c008304bad10d6b0aedc9deef3b

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
libstdc++
patch_id
—
commit_hash
ded7c4e851228c008304bad10d6b0aedc9deef3b
source_type
github
headline
libstdc++: Reject impossible regex DFS starts early
tldr
Added a pre-check to libstdc++'s regex engine to quickly reject impossible match starting positions.
author
Tamar Christina
outcome
committed
performance_win
true
breaking_change
false
series_id
—
series_parts
[]
tags
  • • libstdc++
  • • regex
  • • optimization
  • • performance
discussion_id_link
—
bugzilla_pr
—
date
2026-09-22T00:00:00.000Z

This commit introduces a pre-check to the DFS regex executor that examines the first character of a potential match. It rejects starting positions where no match is possible without building the full DFS state, which can be expensive. This optimization significantly speeds up regex searches, particularly for patterns like IPv4 addresses where many positions cannot possibly start a valid match.