- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit5873594
committed
Avoid repeated creation/freeing of per-subre DFAs during regex search.
In nested sub-regex trees, lower-level nodes created DFAs and thendestroyed them again before exiting, which is a bit dumb considering thatthe recursive search is likely to call those nodes again later. Insteadcache each created DFA until the end of pg_regexec(). This is basically aspace for time tradeoff, in that it might increase the maximum memoryusage. However, in most regex patterns there are not all that many subrenodes, so not that many DFAs --- and in any case, the peak usage occurswhen reaching the bottom recursion level, and except for alternation casesthat's going to be the same anyway.1 parent3cbfe48 commit5873594