Skip site navigation (1) Skip section navigation (2)

pgsql: Avoid repeated creation/freeing of per-subre DFAs during regexs

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Avoid repeated creation/freeing of per-subre DFAs during regexs
Date: 2012-02-24 23:40:56
Message-ID: E1S14ky-0004cH-TK@gemulon.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Avoid repeated creation/freeing of per-subre DFAs during regex search.

In nested sub-regex trees, lower-level nodes created DFAs and then
destroyed them again before exiting, which is a bit dumb considering that
the recursive search is likely to call those nodes again later.  Instead
cache each created DFA until the end of pg_regexec().  This is basically a
space for time tradeoff, in that it might increase the maximum memory
usage.  However, in most regex patterns there are not all that many subre
nodes, so not that many DFAs --- and in any case, the peak usage occurs
when reaching the bottom recursion level, and except for alternation cases
that's going to be the same anyway.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/587359479acbbdc95c8e37da40707e37097423f5

Modified Files
--------------
src/backend/regex/regexec.c |  158 ++++++++++++++++++-------------------------
src/include/regex/regguts.h |    4 +-
2 files changed, 68 insertions(+), 94 deletions(-)

pgsql-committers by date

Next:From: Magnus HaganderDate: 2012-02-25 14:33:14
Subject: pgsql: Merge the list of statistics functions into the viewdocumentati
Previous:From: Bruce MomjianDate: 2012-02-24 21:19:28
Subject: pgsql: Mention original ctags option name.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group