summaryrefslogtreecommitdiff
path: root/src/include/tsearch/dicts
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2010-10-06 19:31:05 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2010-10-06 19:31:05 -0400
commit3e5f9412d0a818be77c974e5af710928097b91f3 (patch)
treea6af46a9b605ff412ac2db0be3b659cc41907546 /src/include/tsearch/dicts
parent9b910def24e85c1c4ff993eae0fe511271fc8682 (diff)
downloadpostgresql-3e5f9412d0a818be77c974e5af710928097b91f3.tar.gz
Reduce the memory requirement for large ispell dictionaries.
This patch eliminates per-chunk palloc overhead for most small allocations needed in the representation of an ispell dictionary. This saves close to a factor of 2 on the current Czech ispell data. While it doesn't cover every last small allocation in the ispell code, we are at the point of diminishing returns, because about 95% of the allocations are covered already. Pavel Stehule, rather heavily revised by Tom
Diffstat (limited to 'src/include/tsearch/dicts')
-rw-r--r--src/include/tsearch/dicts/spell.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/include/tsearch/dicts/spell.h b/src/include/tsearch/dicts/spell.h
index 421a636dc7..b41fbb6fd5 100644
--- a/src/include/tsearch/dicts/spell.h
+++ b/src/include/tsearch/dicts/spell.h
@@ -161,6 +161,10 @@ typedef struct
SPELL **Spell;
int nspell; /* number of valid entries in Spell array */
int mspell; /* allocated length of Spell array */
+
+ /* These are used to allocate "compact" data without palloc overhead */
+ char *firstfree; /* first free address (always maxaligned) */
+ size_t avail; /* free space remaining at firstfree */
} IspellDict;
extern TSLexeme *NINormalizeWord(IspellDict *Conf, char *word);