From fbd0e7bfe987fec604a1735fdf7012e6d033d9f3 Mon Sep 17 00:00:00 2001 From: Steve Yen Date: Thu, 7 Jan 2016 00:23:25 -0800 Subject: [PATCH] upside_down backIndexTermEntries precalloc'ed capacity --- index/upside_down/analysis.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index/upside_down/analysis.go b/index/upside_down/analysis.go index 43bf99f1..dbb732b7 100644 --- a/index/upside_down/analysis.go +++ b/index/upside_down/analysis.go @@ -24,7 +24,6 @@ func (udc *UpsideDownCouch) Analyze(d *document.Document) *index.AnalysisResult docIDBytes := []byte(d.ID) // track our back index entries - backIndexTermEntries := make([]*BackIndexTermEntry, 0) backIndexStoredEntries := make([]*BackIndexStoreEntry, 0) // information we collate as we merge fields with same name @@ -82,8 +81,9 @@ func (udc *UpsideDownCouch) Analyze(d *document.Document) *index.AnalysisResult rowsCapNeeded += len(tokenFreqs) } - rows := make([]index.IndexRow, 0, rowsCapNeeded) - rv.Rows = append(rows, rv.Rows...) + rv.Rows = append(make([]index.IndexRow, 0, rowsCapNeeded), rv.Rows...) + + backIndexTermEntries := make([]*BackIndexTermEntry, 0, rowsCapNeeded) // walk through the collated information and proccess // once for each indexed field (unique name)