aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/operatorcmds.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2021-08-17 12:00:02 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2021-08-17 12:00:02 -0400
commit78a843f119ca7d4a6eb173a7ee3bed45889d48d8 (patch)
treef87ef8ebaf0daa5064dd19df9e942bd22d8872b3 /src/backend/commands/operatorcmds.c
parentf576de1db1eeca63180b1ffa4b42b1e360f88577 (diff)
downloadpostgresql-78a843f119ca7d4a6eb173a7ee3bed45889d48d8.tar.gz
postgresql-78a843f119ca7d4a6eb173a7ee3bed45889d48d8.zip
Improve regex compiler's arc moving/copying logic.
The functions moveins(), copyins(), moveouts(), copyouts() are required to preserve the invariant that there are no duplicate arcs in the regex's NFA. Spencer's original implementation of them was O(N^2) since it checked separately for a match to each source arc. In commit 579840ca0 I improved that by adding sort/merge logic to be used if more than a few arcs are to be moved/copied. However, I now realize that that missed a bet. At many call sites, the target state is newly made and cannot have any existing in-arcs (respectively out-arcs) that could be duplicates. So spending any cycles at all on checking for duplicates is wasted effort; in these cases we can just blindly move/copy all the source arcs. Add code paths to do that. It turns out that for copyins()/copyouts(), *all* the call sites have this property, making all the "improved" logic in them flat out unreachable. Perhaps we'll need the full capability again someday, so I just #ifdef'd those paths out rather than removing them entirely. In passing, add a few test cases to improve code coverage in this area as well as in regc_locale.c/regc_pg_locale.c. Discussion: https://postgr.es/m/810272.1629064063@sss.pgh.pa.us
Diffstat (limited to 'src/backend/commands/operatorcmds.c')
0 files changed, 0 insertions, 0 deletions