From bd5988117edcef0ff88e6f3c11583559e13baad2 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Tue, 23 May 2023 12:45:34 +0000 Subject: Call get_has_btree_dictionary once. Order small members by size at the end to avoid holes in the class. --- .../attribute/postinglistsearchcontext.cpp | 24 +++++++++------------- .../searchlib/attribute/postinglistsearchcontext.h | 19 ++++++++--------- .../attribute/postinglistsearchcontext.hpp | 5 ++--- 3 files changed, 21 insertions(+), 27 deletions(-) (limited to 'searchlib') diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.cpp b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.cpp index 0c34ae6e330..12c887eb407 100644 --- a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.cpp +++ b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.cpp @@ -10,28 +10,24 @@ namespace search::attribute { using vespalib::btree::BTreeNode; PostingListSearchContext:: -PostingListSearchContext(const IEnumStoreDictionary& dictionary, - uint32_t docIdLimit, - uint64_t numValues, - bool hasWeight, - bool useBitVector, - const ISearchContext &baseSearchCtx) +PostingListSearchContext(const IEnumStoreDictionary& dictionary, bool has_btree_dictionary, uint32_t docIdLimit, + uint64_t numValues, bool hasWeight, bool useBitVector, const ISearchContext &baseSearchCtx) : _dictionary(dictionary), - _frozenDictionary(_dictionary.get_has_btree_dictionary() ? _dictionary.get_posting_dictionary().getFrozenView() : FrozenDictionary()), - _lowerDictItr(_dictionary.get_has_btree_dictionary() ? DictionaryConstIterator(BTreeNode::Ref(), _frozenDictionary.getAllocator()) : DictionaryConstIterator()), - _upperDictItr(_dictionary.get_has_btree_dictionary() ? DictionaryConstIterator(BTreeNode::Ref(), _frozenDictionary.getAllocator()) : DictionaryConstIterator()), + _baseSearchCtx(baseSearchCtx), + _bv(nullptr), + _frozenDictionary(has_btree_dictionary ? _dictionary.get_posting_dictionary().getFrozenView() : FrozenDictionary()), + _lowerDictItr(has_btree_dictionary ? DictionaryConstIterator(BTreeNode::Ref(), _frozenDictionary.getAllocator()) : DictionaryConstIterator()), + _upperDictItr(has_btree_dictionary ? DictionaryConstIterator(BTreeNode::Ref(), _frozenDictionary.getAllocator()) : DictionaryConstIterator()), + _numValues(numValues), _uniqueValues(0u), _docIdLimit(docIdLimit), _dictSize(_frozenDictionary.size()), - _numValues(numValues), - _hasWeight(hasWeight), - _useBitVector(useBitVector), _pidx(), _frozenRoot(), _FSTC(0.0), _PLSTC(0.0), - _bv(nullptr), - _baseSearchCtx(baseSearchCtx) + _hasWeight(hasWeight), + _useBitVector(useBitVector) { } diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h index d0a8958f615..107abd24069 100644 --- a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h +++ b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h @@ -32,26 +32,25 @@ protected: using FrozenDictionary = Dictionary::FrozenView; using EnumIndex = IEnumStore::Index; - const IEnumStoreDictionary& _dictionary; - const FrozenDictionary _frozenDictionary; + const IEnumStoreDictionary & _dictionary; + const ISearchContext &_baseSearchCtx; + const BitVector *_bv; // bitvector if _useBitVector has been set + const FrozenDictionary _frozenDictionary; DictionaryConstIterator _lowerDictItr; DictionaryConstIterator _upperDictItr; + uint64_t _numValues; // attr.getStatus().getNumValues(); uint32_t _uniqueValues; uint32_t _docIdLimit; uint32_t _dictSize; - uint64_t _numValues; // attr.getStatus().getNumValues(); - bool _hasWeight; - bool _useBitVector; vespalib::datastore::EntryRef _pidx; vespalib::datastore::EntryRef _frozenRoot; // Posting list in tree form float _FSTC; // Filtering Search Time Constant float _PLSTC; // Posting List Search Time Constant - const BitVector *_bv; // bitvector if _useBitVector has been set - const ISearchContext &_baseSearchCtx; - + bool _hasWeight; + bool _useBitVector; - PostingListSearchContext(const IEnumStoreDictionary& dictionary, uint32_t docIdLimit, uint64_t numValues, bool hasWeight, - bool useBitVector, const ISearchContext &baseSearchCtx); + PostingListSearchContext(const IEnumStoreDictionary& dictionary, bool has_btree_dictionary, uint32_t docIdLimit, + uint64_t numValues, bool hasWeight, bool useBitVector, const ISearchContext &baseSearchCtx); ~PostingListSearchContext() override; diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp index 98f89f9080f..d32d8cde7ea 100644 --- a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp +++ b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp @@ -22,9 +22,8 @@ namespace search::attribute { template PostingListSearchContextT:: PostingListSearchContextT(const IEnumStoreDictionary& dictionary, uint32_t docIdLimit, uint64_t numValues, bool hasWeight, - const PostingList &postingList, - bool useBitVector, const ISearchContext &searchContext) - : PostingListSearchContext(dictionary, docIdLimit, numValues, hasWeight, useBitVector, searchContext), + const PostingList &postingList, bool useBitVector, const ISearchContext &searchContext) + : PostingListSearchContext(dictionary, dictionary.get_has_btree_dictionary(), docIdLimit, numValues, hasWeight, useBitVector, searchContext), _postingList(postingList), _merger(docIdLimit) { -- cgit v1.2.3