postgresql/contrib/pg_trgm
Tom Lane 0a5d5a49d9 Cache the result of makesign() across calls of gtrgm_penalty().
Since gtrgm_penalty() is usually called many times in a row with the same
"newval" (to determine which item on an index page newval fits into best),
the makesign() calculation is repetitious.  It's expensive enough to make
it worth caching the result, so do so.  On my machine this is good for
more than a 40% savings in the time needed to build a trigram index on
/usr/share/dict/words.  This is all per a suggestion of Heikki's.

In passing, make some mostly-cosmetic improvements in the caching logic in
the other functions in this file that rely on caching info in fn_extra.
2011-09-30 23:54:27 -04:00
..
data trgm - Trigram matching for PostgreSQL 2004-05-31 17:18:12 +00:00
expected Convert contrib modules to use the extension facility. 2011-02-13 22:54:49 -05:00
sql Convert contrib modules to use the extension facility. 2011-02-13 22:54:49 -05:00
.gitignore Support "make check" in contrib 2011-04-25 22:27:11 +03:00
Makefile Convert contrib modules to use the extension facility. 2011-02-13 22:54:49 -05:00
pg_trgm--1.0.sql Fix contrib/pg_trgm to have smoother updates from 9.0. 2011-02-17 15:04:33 -05:00
pg_trgm--unpackaged--1.0.sql Fix contrib/pg_trgm to have smoother updates from 9.0. 2011-02-17 15:04:33 -05:00
pg_trgm.control Convert contrib modules to use the extension facility. 2011-02-13 22:54:49 -05:00
trgm.h Remove many -Wcast-qual warnings 2011-09-11 21:54:32 +03:00
trgm_gin.c Remove unnecessary #include references, per pgrminclude script. 2011-09-01 10:04:27 -04:00
trgm_gist.c Cache the result of makesign() across calls of gtrgm_penalty(). 2011-09-30 23:54:27 -04:00
trgm_op.c Remove unnecessary #include references, per pgrminclude script. 2011-09-01 10:04:27 -04:00