summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-05-23 17:09:11 +0200
committerGitHub <noreply@github.com>2023-05-23 17:09:11 +0200
commit5113dccbb084ef043d867e1b219f9593ea5fe579 (patch)
treed9ac4e3f235646dfba3b8a13418a55d8c65554a1
parentdeb431d5e0d1b4ce0799137bdb6e98f6e920f059 (diff)
parent3df6866688b9dd446dafd06e954c660b714a2e09 (diff)
Merge pull request #27185 from vespa-engine/balder/inline-small-frequently-called-methods
Balder/inline small frequently called methods
-rw-r--r--searchlib/src/vespa/searchlib/attribute/bitvector_search_cache.cpp11
-rw-r--r--searchlib/src/vespa/searchlib/attribute/enumcomparator.cpp12
-rw-r--r--searchlib/src/vespa/searchlib/attribute/enumcomparator.h8
-rw-r--r--searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.cpp24
-rw-r--r--searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h19
-rw-r--r--searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp5
-rw-r--r--searchlib/src/vespa/searchlib/attribute/search_context.cpp8
-rw-r--r--searchlib/src/vespa/searchlib/attribute/search_context.h7
-rw-r--r--searchlib/src/vespa/searchlib/memoryindex/field_index.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/util/rawbuf.cpp60
-rw-r--r--searchlib/src/vespa/searchlib/util/rawbuf.h39
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreeroot.h24
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreeroot.hpp115
13 files changed, 108 insertions, 226 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/bitvector_search_cache.cpp b/searchlib/src/vespa/searchlib/attribute/bitvector_search_cache.cpp
index 75e0a82ff1d..4b8916273e7 100644
--- a/searchlib/src/vespa/searchlib/attribute/bitvector_search_cache.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/bitvector_search_cache.cpp
@@ -8,15 +8,8 @@ namespace search::attribute {
using BitVectorSP = BitVectorSearchCache::BitVectorSP;
-BitVectorSearchCache::BitVectorSearchCache()
- : _mutex(),
- _cache()
-{
-}
-
-BitVectorSearchCache::~BitVectorSearchCache()
-{
-}
+BitVectorSearchCache::BitVectorSearchCache() = default;
+BitVectorSearchCache::~BitVectorSearchCache() = default;
void
BitVectorSearchCache::insert(const vespalib::string &term, Entry::SP entry)
diff --git a/searchlib/src/vespa/searchlib/attribute/enumcomparator.cpp b/searchlib/src/vespa/searchlib/attribute/enumcomparator.cpp
index 0f52b64ede0..5a5702f50e8 100644
--- a/searchlib/src/vespa/searchlib/attribute/enumcomparator.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/enumcomparator.cpp
@@ -6,18 +6,6 @@
namespace search {
template <typename EntryT>
-EnumStoreComparator<EntryT>::EnumStoreComparator(const DataStoreType& data_store, const EntryT& fallback_value)
- : ParentType(data_store, fallback_value)
-{
-}
-
-template <typename EntryT>
-EnumStoreComparator<EntryT>::EnumStoreComparator(const DataStoreType& data_store)
- : ParentType(data_store)
-{
-}
-
-template <typename EntryT>
bool
EnumStoreComparator<EntryT>::equal_helper(const EntryT& lhs, const EntryT& rhs)
{
diff --git a/searchlib/src/vespa/searchlib/attribute/enumcomparator.h b/searchlib/src/vespa/searchlib/attribute/enumcomparator.h
index 5df85cd1c57..546ac82e389 100644
--- a/searchlib/src/vespa/searchlib/attribute/enumcomparator.h
+++ b/searchlib/src/vespa/searchlib/attribute/enumcomparator.h
@@ -18,8 +18,12 @@ public:
using ParentType = vespalib::datastore::UniqueStoreComparator<EntryT, IEnumStore::InternalIndex>;
using DataStoreType = typename ParentType::DataStoreType;
- EnumStoreComparator(const DataStoreType& data_store, const EntryT& fallback_value);
- EnumStoreComparator(const DataStoreType& data_store);
+ EnumStoreComparator(const DataStoreType& data_store, const EntryT& fallback_value)
+ : ParentType(data_store, fallback_value)
+ {}
+ EnumStoreComparator(const DataStoreType& data_store)
+ : ParentType(data_store)
+ {}
static bool equal_helper(const EntryT& lhs, const EntryT& rhs);
};
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 <typename DataT>
PostingListSearchContextT<DataT>::
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)
{
diff --git a/searchlib/src/vespa/searchlib/attribute/search_context.cpp b/searchlib/src/vespa/searchlib/attribute/search_context.cpp
index a0345ddce70..a0208ab787e 100644
--- a/searchlib/src/vespa/searchlib/attribute/search_context.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/search_context.cpp
@@ -10,14 +10,6 @@ using search::queryeval::SearchIterator;
namespace search::attribute {
-SearchContext::SearchContext(const AttributeVector &attr) noexcept
- : _attr(attr),
- _plsc(nullptr)
-{
-}
-
-SearchContext::~SearchContext() = default;
-
unsigned int
SearchContext::approximateHits() const
{
diff --git a/searchlib/src/vespa/searchlib/attribute/search_context.h b/searchlib/src/vespa/searchlib/attribute/search_context.h
index 025b0fdf113..cc55beee216 100644
--- a/searchlib/src/vespa/searchlib/attribute/search_context.h
+++ b/searchlib/src/vespa/searchlib/attribute/search_context.h
@@ -30,7 +30,7 @@ public:
SearchContext(SearchContext&&) noexcept = default;
SearchContext& operator=(const SearchContext&) = delete;
SearchContext& operator=(SearchContext&&) noexcept = delete;
- ~SearchContext() override;
+ ~SearchContext() override = default;
unsigned int approximateHits() const override;
std::unique_ptr<queryeval::SearchIterator> createIterator(fef::TermFieldMatchData* matchData, bool strict) override;
@@ -47,7 +47,10 @@ public:
const AttributeVector& attribute() const { return _attr; }
protected:
- SearchContext(const AttributeVector& attr) noexcept;
+ SearchContext(const AttributeVector& attr) noexcept
+ : _attr(attr),
+ _plsc(nullptr)
+ {}
const AttributeVector& _attr;
attribute::IPostingListSearchContext* _plsc;
diff --git a/searchlib/src/vespa/searchlib/memoryindex/field_index.cpp b/searchlib/src/vespa/searchlib/memoryindex/field_index.cpp
index 093052608c5..199e9a4b8a0 100644
--- a/searchlib/src/vespa/searchlib/memoryindex/field_index.cpp
+++ b/searchlib/src/vespa/searchlib/memoryindex/field_index.cpp
@@ -97,7 +97,7 @@ FieldIndex<interleaved_features>::findFrozen(const vespalib::stringref word) con
if (itr.valid()) {
return _postingListStore.beginFrozen(itr.getData().load_acquire());
}
- return typename PostingList::Iterator();
+ return typename PostingList::ConstIterator();
}
template <bool interleaved_features>
diff --git a/searchlib/src/vespa/searchlib/util/rawbuf.cpp b/searchlib/src/vespa/searchlib/util/rawbuf.cpp
index 04d69544047..3af29d7eed5 100644
--- a/searchlib/src/vespa/searchlib/util/rawbuf.cpp
+++ b/searchlib/src/vespa/searchlib/util/rawbuf.cpp
@@ -1,32 +1,11 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "rawbuf.h"
-#include <vespa/vespalib/util/compress.h>
#include <cassert>
-#include <cstring>
#include <cstdlib>
namespace search {
-RawBuf::RawBuf(size_t size)
- : _bufStart(nullptr),
- _bufEnd(nullptr),
- _bufFillPos(nullptr),
- _bufDrainPos(nullptr)
-{
- if (size > 0) {
- _bufStart = static_cast<char *>(malloc(size));
- }
- _bufEnd = _bufStart + size;
- _bufDrainPos = _bufFillPos = _bufStart;
-}
-
-RawBuf::~RawBuf()
-{
- free(_bufStart);
-}
-
-
/**
* Allocate a new buffer at least as large as the parameter value,
* move any content to the new and delete the old buffer.
@@ -50,45 +29,6 @@ RawBuf::expandBuf(size_t needlen)
_bufEnd = _bufStart + size;
}
-
-/**
- * Put 'data' of 'len'gth into the buffer. If insufficient room,
- * make the buffer larger.
- */
-void
-RawBuf::append(const void *data, size_t len)
-{
- if (__builtin_expect(len != 0, true)) {
- ensureSize(len);
- memcpy(_bufFillPos, data, len);
- _bufFillPos += len;
- }
-}
-
-void
-RawBuf::append(uint8_t byte)
-{
- ensureSize(1);
- *_bufFillPos++ = byte;
-}
-
-void
-RawBuf::appendCompressedPositiveNumber(uint64_t n)
-{
- size_t len(vespalib::compress::Integer::compressedPositiveLength(n));
- ensureSize(len);
- _bufFillPos += vespalib::compress::Integer::compressPositive(n, _bufFillPos);
-}
-
-void
-RawBuf::appendCompressedNumber(int64_t n)
-{
- size_t len(vespalib::compress::Integer::compressedLength(n));
- ensureSize(len);
- _bufFillPos += vespalib::compress::Integer::compress(n, _bufFillPos);
-}
-
-
/**
* Compact any free space from the beginning of the buffer, by
* copying the contents to the start of the buffer.
diff --git a/searchlib/src/vespa/searchlib/util/rawbuf.h b/searchlib/src/vespa/searchlib/util/rawbuf.h
index 30018cb45c2..9ecfbc23c24 100644
--- a/searchlib/src/vespa/searchlib/util/rawbuf.h
+++ b/searchlib/src/vespa/searchlib/util/rawbuf.h
@@ -2,8 +2,9 @@
#pragma once
-#include <cstdint>
-#include <cstddef>
+#include <vespa/vespalib/util/compress.h>
+#include <cstring>
+#include <cstdlib>
namespace search {
/**
@@ -45,13 +46,35 @@ private:
public:
RawBuf(const RawBuf &) = delete;
RawBuf& operator=(const RawBuf &) = delete;
- explicit RawBuf(size_t size); // malloc-s given size, assigns to _bufStart
- ~RawBuf(); // Frees _bufStart, i.e. the char[].
+ explicit RawBuf(size_t size)
+ : _bufStart(static_cast<char *>(malloc(size))),
+ _bufEnd(_bufStart + size),
+ _bufFillPos(_bufStart),
+ _bufDrainPos(_bufStart)
+ { }
+ ~RawBuf() {
+ free(_bufStart);
+ } // Frees _bufStart, i.e. the char[].
- void append(const void *data, size_t len);
- void append(uint8_t byte);
- void appendCompressedPositiveNumber(uint64_t n);
- void appendCompressedNumber(int64_t n);
+ void append(const void *data, size_t len) {
+ if (__builtin_expect(len != 0, true)) {
+ ensureSize(len);
+ memcpy(_bufFillPos, data, len);
+ _bufFillPos += len;
+ }
+ }
+ void append(uint8_t byte) {
+ ensureSize(1);
+ *_bufFillPos++ = byte;
+ }
+ void appendCompressedPositiveNumber(uint64_t n) {
+ ensureSize(vespalib::compress::Integer::compressedPositiveLength(n));
+ _bufFillPos += vespalib::compress::Integer::compressPositive(n, _bufFillPos);
+ }
+ void appendCompressedNumber(int64_t n) {
+ ensureSize(vespalib::compress::Integer::compressedLength(n));
+ _bufFillPos += vespalib::compress::Integer::compress(n, _bufFillPos);
+ }
size_t GetFreeLen() const { return _bufEnd - _bufFillPos; }
const char *GetDrainPos() const { return _bufDrainPos; }
char * GetWritableFillPos(size_t len) { preAlloc(len); return _bufFillPos; }
diff --git a/vespalib/src/vespa/vespalib/btree/btreeroot.h b/vespalib/src/vespa/vespalib/btree/btreeroot.h
index f3e60f91f36..cd1d98725dc 100644
--- a/vespalib/src/vespa/vespalib/btree/btreeroot.h
+++ b/vespalib/src/vespa/vespalib/btree/btreeroot.h
@@ -61,15 +61,14 @@ public:
const NodeAllocatorType *const _allocator;
public:
using Iterator = ConstIterator;
- FrozenView();
- FrozenView(BTreeNode::Ref frozenRoot,
- const NodeAllocatorType & allocator);
- ConstIterator find(const KeyType& key,
- CompareT comp = CompareT()) const;
- ConstIterator lowerBound(const KeyType &key,
- CompareT comp = CompareT()) const;
- ConstIterator upperBound(const KeyType &key,
- CompareT comp = CompareT()) const;
+ FrozenView() : _frozenRoot(BTreeNode::Ref()),_allocator(nullptr) {}
+ FrozenView(BTreeNode::Ref frozenRoot, const NodeAllocatorType & allocator)
+ : _frozenRoot(frozenRoot),
+ _allocator(&allocator)
+ {}
+ ConstIterator find(const KeyType& key, CompareT comp = CompareT()) const;
+ ConstIterator lowerBound(const KeyType &key, CompareT comp = CompareT()) const;
+ ConstIterator upperBound(const KeyType &key, CompareT comp = CompareT()) const;
ConstIterator begin() const {
return ConstIterator(_frozenRoot, *_allocator);
}
@@ -78,7 +77,12 @@ public:
}
BTreeNode::Ref getRoot() const { return _frozenRoot; }
- size_t size() const;
+ size_t size() const {
+ if (NodeAllocatorType::isValidRef(_frozenRoot)) {
+ return _allocator->validLeaves(_frozenRoot);
+ }
+ return 0u;
+ }
const NodeAllocatorType &getAllocator() const { return *_allocator; }
const AggrT &getAggregated() const {
diff --git a/vespalib/src/vespa/vespalib/btree/btreeroot.hpp b/vespalib/src/vespa/vespalib/btree/btreeroot.hpp
index fdcc957009b..73e5fb32b92 100644
--- a/vespalib/src/vespa/vespalib/btree/btreeroot.hpp
+++ b/vespalib/src/vespa/vespalib/btree/btreeroot.hpp
@@ -14,8 +14,7 @@ namespace vespalib::btree {
//----------------------- BTreeRoot ------------------------------------------//
-template <typename KeyT, typename DataT, typename AggrT, typename CompareT,
- typename TraitsT>
+template <typename KeyT, typename DataT, typename AggrT, typename CompareT, typename TraitsT>
vespalib::string
BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::
toString(BTreeNode::Ref node,
@@ -123,8 +122,7 @@ isValid(BTreeNode::Ref node,
return true;
}
-template <typename KeyT, typename DataT, typename AggrT, typename CompareT,
- typename TraitsT>
+template <typename KeyT, typename DataT, typename AggrT, typename CompareT, typename TraitsT>
typename BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::Iterator
BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::
findHelper(BTreeNode::Ref root, const KeyType & key,
@@ -138,20 +136,17 @@ findHelper(BTreeNode::Ref root, const KeyType & key,
return itr;
}
-template <typename KeyT, typename DataT, typename AggrT, typename CompareT,
- typename TraitsT>
+template <typename KeyT, typename DataT, typename AggrT, typename CompareT, typename TraitsT>
typename BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::Iterator
BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::
-lowerBoundHelper(BTreeNode::Ref root, const KeyType & key,
- const NodeAllocatorType & allocator, CompareT comp)
+lowerBoundHelper(BTreeNode::Ref root, const KeyType & key, const NodeAllocatorType & allocator, CompareT comp)
{
Iterator itr(BTreeNode::Ref(), allocator);
itr.lower_bound(root, key, comp);
return itr;
}
-template <typename KeyT, typename DataT, typename AggrT, typename CompareT,
- typename TraitsT>
+template <typename KeyT, typename DataT, typename AggrT, typename CompareT, typename TraitsT>
typename BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::Iterator
BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::
upperBoundHelper(BTreeNode::Ref root, const KeyType & key,
@@ -167,31 +162,10 @@ upperBoundHelper(BTreeNode::Ref root, const KeyType & key,
//----------------------- BTreeRoot::FrozenView ----------------------------------//
-template <typename KeyT, typename DataT, typename AggrT, typename CompareT,
- typename TraitsT>
-BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::
-FrozenView::FrozenView()
- : _frozenRoot(BTreeNode::Ref()),
- _allocator(nullptr)
-{
-}
-
-template <typename KeyT, typename DataT, typename AggrT, typename CompareT,
- typename TraitsT>
-BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::
-FrozenView::FrozenView(BTreeNode::Ref frozenRoot,
- const NodeAllocatorType & allocator)
- : _frozenRoot(frozenRoot),
- _allocator(&allocator)
-{
-}
-
-template <typename KeyT, typename DataT, typename AggrT, typename CompareT,
- typename TraitsT>
+template <typename KeyT, typename DataT, typename AggrT, typename CompareT, typename TraitsT>
typename BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::ConstIterator
BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::
-FrozenView::find(const KeyType & key,
- CompareT comp) const
+FrozenView::find(const KeyType & key, CompareT comp) const
{
ConstIterator itr(BTreeNode::Ref(), *_allocator);
itr.lower_bound(_frozenRoot, key, comp);
@@ -201,24 +175,20 @@ FrozenView::find(const KeyType & key,
return itr;
}
-template <typename KeyT, typename DataT, typename AggrT, typename CompareT,
- typename TraitsT>
+template <typename KeyT, typename DataT, typename AggrT, typename CompareT, typename TraitsT>
typename BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::ConstIterator
BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::
-FrozenView::lowerBound(const KeyType & key,
- CompareT comp) const
+FrozenView::lowerBound(const KeyType & key, CompareT comp) const
{
ConstIterator itr(BTreeNode::Ref(), *_allocator);
itr.lower_bound(_frozenRoot, key, comp);
return itr;
}
-template <typename KeyT, typename DataT, typename AggrT, typename CompareT,
- typename TraitsT>
+template <typename KeyT, typename DataT, typename AggrT, typename CompareT, typename TraitsT>
typename BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::ConstIterator
BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::
-FrozenView::upperBound(const KeyType & key,
- CompareT comp) const
+FrozenView::upperBound(const KeyType & key, CompareT comp) const
{
ConstIterator itr(_frozenRoot, *_allocator);
if (itr.valid() && !comp(key, itr.getKey())) {
@@ -227,30 +197,15 @@ FrozenView::upperBound(const KeyType & key,
return itr;
}
-template <typename KeyT, typename DataT, typename AggrT, typename CompareT,
- typename TraitsT>
-size_t
-BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::
-FrozenView::size() const
-{
- if (NodeAllocatorType::isValidRef(_frozenRoot)) {
- return _allocator->validLeaves(_frozenRoot);
- }
- return 0u;
-}
-
//----------------------- BTreeRoot ----------------------------------------------//
-template <typename KeyT, typename DataT, typename AggrT, typename CompareT,
- typename TraitsT>
+template <typename KeyT, typename DataT, typename AggrT, typename CompareT, typename TraitsT>
BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::BTreeRootT() = default;
-template <typename KeyT, typename DataT, typename AggrT, typename CompareT,
- typename TraitsT>
+template <typename KeyT, typename DataT, typename AggrT, typename CompareT, typename TraitsT>
BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::~BTreeRootT() = default;
-template <typename KeyT, typename DataT, typename AggrT, typename CompareT,
- typename TraitsT>
+template <typename KeyT, typename DataT, typename AggrT, typename CompareT, typename TraitsT>
void
BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::
clear(NodeAllocatorType &allocator)
@@ -263,39 +218,32 @@ clear(NodeAllocatorType &allocator)
}
}
-template <typename KeyT, typename DataT, typename AggrT, typename CompareT,
- typename TraitsT>
+template <typename KeyT, typename DataT, typename AggrT, typename CompareT, typename TraitsT>
typename BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::Iterator
BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::
-find(const KeyType & key, const NodeAllocatorType & allocator,
- CompareT comp) const
+find(const KeyType & key, const NodeAllocatorType & allocator, CompareT comp) const
{
return findHelper(_root, key, allocator, comp);
}
-template <typename KeyT, typename DataT, typename AggrT, typename CompareT,
- typename TraitsT>
+template <typename KeyT, typename DataT, typename AggrT, typename CompareT, typename TraitsT>
typename BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::Iterator
BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::
-lowerBound(const KeyType & key, const NodeAllocatorType & allocator,
- CompareT comp) const
+lowerBound(const KeyType & key, const NodeAllocatorType & allocator, CompareT comp) const
{
return lowerBoundHelper(_root, key, allocator, comp);
}
-template <typename KeyT, typename DataT, typename AggrT, typename CompareT,
- typename TraitsT>
+template <typename KeyT, typename DataT, typename AggrT, typename CompareT, typename TraitsT>
typename BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::Iterator
BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::
-upperBound(const KeyType & key, const NodeAllocatorType & allocator,
- CompareT comp) const
+upperBound(const KeyType & key, const NodeAllocatorType & allocator, CompareT comp) const
{
return upperBoundHelper(_root, key, allocator, comp);
}
-template <typename KeyT, typename DataT, typename AggrT, typename CompareT,
- typename TraitsT>
+template <typename KeyT, typename DataT, typename AggrT, typename CompareT, typename TraitsT>
size_t
BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::
size(const NodeAllocatorType &allocator) const
@@ -307,8 +255,7 @@ size(const NodeAllocatorType &allocator) const
}
-template <typename KeyT, typename DataT, typename AggrT, typename CompareT,
- typename TraitsT>
+template <typename KeyT, typename DataT, typename AggrT, typename CompareT, typename TraitsT>
size_t
BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::
frozenSize(const NodeAllocatorType &allocator) const
@@ -321,8 +268,7 @@ frozenSize(const NodeAllocatorType &allocator) const
}
-template <typename KeyT, typename DataT, typename AggrT, typename CompareT,
- typename TraitsT>
+template <typename KeyT, typename DataT, typename AggrT, typename CompareT, typename TraitsT>
vespalib::string
BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::
toString(const NodeAllocatorType &allocator) const
@@ -353,8 +299,7 @@ template <typename KeyT, typename DataT, typename AggrT, typename CompareT,
typename TraitsT, class AggrCalcT>
bool
BTreeRoot<KeyT, DataT, AggrT, CompareT, TraitsT, AggrCalcT>::
-isValidFrozen(const NodeAllocatorType &allocator,
- CompareT comp) const
+isValidFrozen(const NodeAllocatorType &allocator, CompareT comp) const
{
BTreeNode::Ref frozenRoot = getFrozenRoot();
if (NodeAllocatorType::isValidRef(frozenRoot)) {
@@ -382,8 +327,7 @@ template <typename KeyT, typename DataT, typename AggrT, typename CompareT,
typename TraitsT>
size_t
BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::
-bitSize(BTreeNode::Ref node,
- const NodeAllocatorType &allocator) const
+bitSize(BTreeNode::Ref node, const NodeAllocatorType &allocator) const
{
if (allocator.isLeafRef(node)) {
return sizeof(LeafNodeType) * 8;
@@ -399,8 +343,7 @@ bitSize(BTreeNode::Ref node,
}
-template <typename KeyT, typename DataT, typename AggrT, typename CompareT,
- typename TraitsT>
+template <typename KeyT, typename DataT, typename AggrT, typename CompareT, typename TraitsT>
void
BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>::
thaw(Iterator &itr)
@@ -455,8 +398,7 @@ insert(Iterator &itr,
{
using Inserter = BTreeInserter<KeyT, DataT, AggrT, CompareT, TraitsT, AggrCalcT>;
bool oldFrozen = isFrozen();
- Inserter::insert(_root, itr, key, data,
- aggrCalc);
+ Inserter::insert(_root, itr, key, data,aggrCalc);
if (oldFrozen && !isFrozen())
itr.getAllocator().needFreeze(this);
}
@@ -483,8 +425,7 @@ template <typename KeyT, typename DataT, typename AggrT, typename CompareT,
typename TraitsT, class AggrCalcT>
void
BTreeRoot<KeyT, DataT, AggrT, CompareT, TraitsT, AggrCalcT>::
-remove(Iterator &itr,
- const AggrCalcT &aggrCalc)
+remove(Iterator &itr, const AggrCalcT &aggrCalc)
{
using Remover = BTreeRemover<KeyT, DataT, AggrT, CompareT, TraitsT, AggrCalcT>;
bool oldFrozen = isFrozen();