You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Avoid determining regexp subexpression matches, when possible.
Identifying the precise match locations for parenthesized subexpressionsis a fairly expensive task given the way our regexp engine works, bothat regexp compile time (where we must create an optimized NFA for eachparenthesized subexpression) and at runtime (where determining exactmatch locations requires laborious search).Up to now we've made little attempt to optimize this situation. Thispatch identifies cases where we know at compile time that we won'tneed to know subexpression match locations, and teaches the regexpcompiler to not bother creating per-subexpression regexps forparenthesis pairs that are not referenced by backrefs elsewhere inthe regexp. (To preserve semantics, we obviously still have topin down the match locations of backref references.) Users couldhave obtained the same results before this by being careful towrite "non capturing" parentheses wherever possible, but few peoplebother with that.Discussion:https://postgr.es/m/2219936.1628115334@sss.pgh.pa.us