diff options
author | Henning Baldersheim <balder@oath.com> | 2019-06-05 07:40:30 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@oath.com> | 2019-06-05 07:40:30 +0000 |
commit | 0b2ab271ff37a60e4b9e64031ead77ac7b15f692 (patch) | |
tree | a6fb28888e94bf36b5bb5618767bdab469e0a9c2 /searchlib | |
parent | b12903613c564adf19f74e993a03bb0389d37266 (diff) |
Follow grow strategy to avoid resizing the bitvector every 64th bit.
Diffstat (limited to 'searchlib')
-rw-r--r-- | searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp b/searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp index 42802cdd5db..3e260e8453a 100644 --- a/searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp @@ -27,7 +27,14 @@ SingleBoolAttribute::~SingleBoolAttribute() bool SingleBoolAttribute::addDoc(DocId & doc) { - bool incGen = _bv.extend(getNumDocs() + 1); + size_t needSize = getNumDocs() + 1; + bool incGen = false; + if (_bv.capacity() < needSize) { + const GrowStrategy & gs = this->getConfig().getGrowStrategy(); + uint32_t newSize = needSize + (needSize * gs.getDocsGrowFactor()) + gs.getDocsGrowDelta(); + incGen = _bv.reserve(newSize); + } + incGen = _bv.extend(needSize) || incGen; incNumDocs(); doc = getNumDocs() - 1; updateUncommittedDocIdLimit(doc); |