Landing: 24570c4a1b28
Project / Subsystem
gcc / libstdc++
Date
2026-09-22
Author
Tamar Christina
Commit
24570c4a1b2805fc375c5f0fb9881eb3d1f24bc7
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- libstdc++
- patch_id
- —
- commit_hash
- 24570c4a1b2805fc375c5f0fb9881eb3d1f24bc7
- source_type
- github
- headline
- libstdc++: Templatize regex executor traversal mode
- tldr
- Templatized regex executor traversal modes to eliminate runtime branches and improve performance.
- author
- Tamar Christina
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • libstdc++
- • regex
- • optimization
- • performance
- • compile-time
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-09-22T00:00:00.000Z
This commit addresses significant regex performance regressions introduced previously by making the executor’s traversal mode (DFS vs. BFS) a template parameter instead of a runtime member. This allows the compiler to eliminate dead code paths for the unused mode at compile time, reducing dynamic instructions and mispredicted branches. This optimization restores and surpasses the performance of GCC 15 for email, URI, and IPv4 regex matching.