diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-03-10 09:21:43 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-03-10 10:42:29 +0000 |
commit | 959fd4e9fac8cc23fa37ae94960d0855cb569936 (patch) | |
tree | 5a4496194188d93f6ebb68fcfc65c0e94ce13706 /searchlib | |
parent | 1f2b7657d216d7dfff062c32ffb1cab90d080c94 (diff) |
Prefer std::vector<T, vespalib::allocator_large> over vespalib::Array<T> step 1.
Diffstat (limited to 'searchlib')
10 files changed, 34 insertions, 21 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/enum_store_loaders.cpp b/searchlib/src/vespa/searchlib/attribute/enum_store_loaders.cpp index 7f44dbff5cb..eeaa3e9539f 100644 --- a/searchlib/src/vespa/searchlib/attribute/enum_store_loaders.cpp +++ b/searchlib/src/vespa/searchlib/attribute/enum_store_loaders.cpp @@ -76,6 +76,8 @@ EnumeratedLoader::EnumeratedLoader(IEnumStore& store) { } +EnumeratedLoader::~EnumeratedLoader() = default; + void EnumeratedLoader::set_ref_counts() { @@ -118,7 +120,7 @@ EnumeratedPostingsLoader::set_ref_count(Index idx, uint32_t ref_count) vespalib::ArrayRef<vespalib::datastore::EntryRef> EnumeratedPostingsLoader::initialize_empty_posting_indexes() { - vespalib::Array<EntryRef>(_indexes.size(), EntryRef()).swap(_posting_indexes); + EntryRefVector(_indexes.size(), EntryRef()).swap(_posting_indexes); return _posting_indexes; } @@ -128,7 +130,7 @@ EnumeratedPostingsLoader::build_dictionary() attribute::LoadedEnumAttributeVector().swap(_loaded_enums); _store.get_dictionary().build_with_payload(_indexes, _posting_indexes); release_enum_indexes(); - vespalib::Array<EntryRef>().swap(_posting_indexes); + EntryRefVector().swap(_posting_indexes); } } diff --git a/searchlib/src/vespa/searchlib/attribute/enum_store_loaders.h b/searchlib/src/vespa/searchlib/attribute/enum_store_loaders.h index b0d3090b92e..bfd11bafe33 100644 --- a/searchlib/src/vespa/searchlib/attribute/enum_store_loaders.h +++ b/searchlib/src/vespa/searchlib/attribute/enum_store_loaders.h @@ -5,6 +5,7 @@ #include "enum_store_types.h" #include "loadedenumvalue.h" #include <vespa/vespalib/datastore/entryref.h> +#include <vespa/vespalib/stllike/allocator.h> namespace search { class IEnumStore; } @@ -22,6 +23,10 @@ protected: void release_enum_indexes(); public: EnumeratedLoaderBase(IEnumStore& store); + EnumeratedLoaderBase(const EnumeratedLoaderBase &) = delete; + EnumeratedLoaderBase & operator =(const EnumeratedLoaderBase &) = delete; + EnumeratedLoaderBase(EnumeratedLoaderBase &&) = delete; + EnumeratedLoaderBase & operator =(EnumeratedLoaderBase &&) = delete; ~EnumeratedLoaderBase(); const IndexVector& get_enum_indexes() const { return _indexes; } const EnumVector& get_enum_value_remapping() const noexcept { return _enum_value_remapping; } @@ -40,6 +45,11 @@ private: public: EnumeratedLoader(IEnumStore& store); + EnumeratedLoader(const EnumeratedLoader &) = delete; + EnumeratedLoader & operator =(const EnumeratedLoader &) = delete; + EnumeratedLoader(EnumeratedLoader &&) = delete; + EnumeratedLoader & operator =(EnumeratedLoader &&) = delete; + ~EnumeratedLoader(); EnumVector& get_enums_histogram() { return _enums_histogram; } void allocate_enums_histogram() { EnumVector(_indexes.size(), 0).swap(_enums_histogram); @@ -54,12 +64,17 @@ public: class EnumeratedPostingsLoader : public EnumeratedLoaderBase { private: using EntryRef = vespalib::datastore::EntryRef; + using EntryRefVector = std::vector<EntryRef, vespalib::allocator_large<EntryRef>>; attribute::LoadedEnumAttributeVector _loaded_enums; - vespalib::Array<EntryRef> _posting_indexes; + EntryRefVector _posting_indexes; bool _has_btree_dictionary; public: EnumeratedPostingsLoader(IEnumStore& store); + EnumeratedPostingsLoader(const EnumeratedPostingsLoader &) = delete; + EnumeratedPostingsLoader & operator =(const EnumeratedPostingsLoader &) = delete; + EnumeratedPostingsLoader(EnumeratedPostingsLoader &&) = delete; + EnumeratedPostingsLoader & operator =(EnumeratedPostingsLoader &&) = delete; ~EnumeratedPostingsLoader(); attribute::LoadedEnumAttributeVector& get_loaded_enums() { return _loaded_enums; } void reserve_loaded_enums(size_t num_values) { diff --git a/searchlib/src/vespa/searchlib/attribute/enum_store_types.h b/searchlib/src/vespa/searchlib/attribute/enum_store_types.h index d3ce925a41e..d2713d942fd 100644 --- a/searchlib/src/vespa/searchlib/attribute/enum_store_types.h +++ b/searchlib/src/vespa/searchlib/attribute/enum_store_types.h @@ -4,14 +4,14 @@ #include <vespa/searchcommon/attribute/iattributevector.h> #include <vespa/vespalib/datastore/entryref.h> -#include <vespa/vespalib/util/array.h> +#include <vespa/vespalib/stllike/allocator.h> namespace search::enumstore { using Index = vespalib::datastore::EntryRef; using InternalIndex = vespalib::datastore::EntryRefT<22>; -using IndexVector = vespalib::Array<Index>; +using IndexVector = std::vector<Index, vespalib::allocator_large<Index>>; using EnumHandle = attribute::IAttributeVector::EnumHandle; -using EnumVector = vespalib::Array<uint32_t>; +using EnumVector = std::vector<uint32_t, vespalib::allocator_large<uint32_t>>; } diff --git a/searchlib/src/vespa/searchlib/attribute/loadedenumvalue.cpp b/searchlib/src/vespa/searchlib/attribute/loadedenumvalue.cpp index 779e020cdd0..b514275f75d 100644 --- a/searchlib/src/vespa/searchlib/attribute/loadedenumvalue.cpp +++ b/searchlib/src/vespa/searchlib/attribute/loadedenumvalue.cpp @@ -3,8 +3,7 @@ #include "loadedenumvalue.h" #include <vespa/searchlib/common/sort.h> -namespace search { -namespace attribute { +namespace search::attribute { void sortLoadedByEnum(LoadedEnumAttributeVector &loaded) @@ -17,6 +16,5 @@ sortLoadedByEnum(LoadedEnumAttributeVector &loaded) &loaded[0], loaded.size(), 16); } -} // namespace attribute -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/attribute/loadedenumvalue.h b/searchlib/src/vespa/searchlib/attribute/loadedenumvalue.h index 96bdc147559..5dbaed15581 100644 --- a/searchlib/src/vespa/searchlib/attribute/loadedenumvalue.h +++ b/searchlib/src/vespa/searchlib/attribute/loadedenumvalue.h @@ -3,7 +3,7 @@ #pragma once #include "enum_store_types.h" -#include <vespa/vespalib/util/array.h> +#include <vespa/vespalib/stllike/allocator.h> #include <vespa/vespalib/util/arrayref.h> #include <cassert> #include <limits> @@ -67,7 +67,7 @@ public: int32_t getWeight() const { return _weight; } }; -typedef vespalib::Array<LoadedEnumAttribute> LoadedEnumAttributeVector; +using LoadedEnumAttributeVector = std::vector<LoadedEnumAttribute, vespalib::allocator_large<LoadedEnumAttribute>>; /** diff --git a/searchlib/src/vespa/searchlib/docstore/filechunk.h b/searchlib/src/vespa/searchlib/docstore/filechunk.h index 60c788cf9c7..e57fba712fd 100644 --- a/searchlib/src/vespa/searchlib/docstore/filechunk.h +++ b/searchlib/src/vespa/searchlib/docstore/filechunk.h @@ -8,6 +8,7 @@ #include "randread.h" #include <vespa/searchlib/common/tunefileinfo.h> #include <vespa/vespalib/stllike/hash_map.h> +#include <vespa/vespalib/util/array.h> #include <vespa/vespalib/util/cpu_usage.h> #include <vespa/vespalib/util/generationhandler.h> #include <vespa/vespalib/util/memoryusage.h> diff --git a/searchlib/src/vespa/searchlib/docstore/storebybucket.h b/searchlib/src/vespa/searchlib/docstore/storebybucket.h index 05eb7880ae8..1b5f9dc1204 100644 --- a/searchlib/src/vespa/searchlib/docstore/storebybucket.h +++ b/searchlib/src/vespa/searchlib/docstore/storebybucket.h @@ -66,7 +66,7 @@ private: uint32_t _chunkId; uint32_t _lid; }; - using IndexVector = vespalib::Array<Index>; + using IndexVector = std::vector<Index, vespalib::allocator_large<Index>>; uint64_t _chunkSerial; Chunk::UP _current; std::map<uint64_t, IndexVector> _where; diff --git a/searchlib/src/vespa/searchlib/grouping/groupengine.h b/searchlib/src/vespa/searchlib/grouping/groupengine.h index 3a6a680ea1c..778ed2956a8 100644 --- a/searchlib/src/vespa/searchlib/grouping/groupengine.h +++ b/searchlib/src/vespa/searchlib/grouping/groupengine.h @@ -123,15 +123,15 @@ private: size_t getIdBase(GroupRef g) const { return _idByteSize*g; } using IdList = std::unique_ptr<expression::ResultNodeVector>; - typedef vespalib::Array<Children *> GroupBacking; - typedef std::vector<double> RankV; - typedef vespalib::Array<uint8_t> IdBacking; + using GroupBacking = std::vector<Children *>; + using RankV = std::vector<double>; + using IdBacking = std::vector<uint8_t>; const aggregation::GroupingLevel * _request; GroupEngine * _nextEngine; // This is the engine for the next level. size_t _idByteSize; // Correct fixed size of memory needed for one id. IdBacking _ids; // These are all the group ids at this level. - expression::ResultNode::UP _idScratch; // Used for typing the ids. + expression::ResultNode::UP _idScratch; // Used for typing the ids. RankV _rank; // This is the rank of the group. TODO handle with ordinary aggregator. GroupBacking _groupBacking; // These are all the children at this level. Vector<HashTable<GroupRef()>> size_t _level; // This is my level diff --git a/searchlib/src/vespa/searchlib/grouping/groupingengine.h b/searchlib/src/vespa/searchlib/grouping/groupingengine.h index cf5bcaa63f8..b0dbb3f8528 100644 --- a/searchlib/src/vespa/searchlib/grouping/groupingengine.h +++ b/searchlib/src/vespa/searchlib/grouping/groupingengine.h @@ -4,8 +4,7 @@ #include <vespa/searchlib/aggregation/grouping.h> #include <vespa/searchlib/grouping/groupengine.h> -namespace search { -namespace grouping { +namespace search::grouping { class GroupingEngine { @@ -32,4 +31,3 @@ private: }; } -} diff --git a/searchlib/src/vespa/searchlib/queryeval/matching_elements_search.cpp b/searchlib/src/vespa/searchlib/queryeval/matching_elements_search.cpp index 4a522a00583..a5c3bc8c247 100644 --- a/searchlib/src/vespa/searchlib/queryeval/matching_elements_search.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/matching_elements_search.cpp @@ -115,7 +115,6 @@ namespace vespalib { template class hash_set<const char *>; template class hashtable<const char *, const char *, hash<const char *>, search::queryeval::EqualCStringValue, Identity, hashtable_base::and_modulator>; -template class Array<vespalib::hash_node<const char *>>; } |