diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-06-27 23:51:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-27 23:51:48 +0200 |
commit | 0de329866f0a536a0a675a54af4ee84e34e50c1b (patch) | |
tree | a92502a74df5c49810b6877e032816c70dc3883f | |
parent | 8a950d04ee85d5078ae1b0091ca27e7144da208f (diff) | |
parent | 505af4a5205e08b2afb7f7b04eeb1a0fb5c43abb (diff) |
Merge pull request #27560 from vespa-engine/toregge/reduce-number-of-buffer-types-for-raw-buffer-store
Reduce max type id for raw buffer store.
3 files changed, 11 insertions, 15 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/raw_buffer_store.cpp b/searchlib/src/vespa/searchlib/attribute/raw_buffer_store.cpp index 0c6dd9c75a8..520309f83b7 100644 --- a/searchlib/src/vespa/searchlib/attribute/raw_buffer_store.cpp +++ b/searchlib/src/vespa/searchlib/attribute/raw_buffer_store.cpp @@ -16,14 +16,14 @@ constexpr float ALLOC_GROW_FACTOR = 0.2; namespace search::attribute { -RawBufferStore::RawBufferStore(std::shared_ptr<vespalib::alloc::MemoryAllocator> allocator, uint32_t max_small_buffer_type_id, double grow_factor) - : _array_store(ArrayStoreType::optimizedConfigForHugePage(max_small_buffer_type_id, - TypeMapper(max_small_buffer_type_id, grow_factor, ArrayStoreConfig::default_max_buffer_size), +RawBufferStore::RawBufferStore(std::shared_ptr<vespalib::alloc::MemoryAllocator> allocator, uint32_t max_type_id, double grow_factor) + : _array_store(ArrayStoreType::optimizedConfigForHugePage(max_type_id, + TypeMapper(max_type_id, grow_factor, max_buffer_size), MemoryAllocator::HUGEPAGE_SIZE, MemoryAllocator::PAGE_SIZE, - ArrayStoreConfig::default_max_buffer_size, + max_buffer_size, 8_Ki, ALLOC_GROW_FACTOR), - std::move(allocator), TypeMapper(max_small_buffer_type_id, grow_factor, ArrayStoreConfig::default_max_buffer_size)) + std::move(allocator), TypeMapper(max_type_id, grow_factor, max_buffer_size)) { } diff --git a/searchlib/src/vespa/searchlib/attribute/raw_buffer_store.h b/searchlib/src/vespa/searchlib/attribute/raw_buffer_store.h index a3f5b564846..8bb500e58da 100644 --- a/searchlib/src/vespa/searchlib/attribute/raw_buffer_store.h +++ b/searchlib/src/vespa/searchlib/attribute/raw_buffer_store.h @@ -22,7 +22,11 @@ class RawBufferStore ArrayStoreType _array_store; public: - RawBufferStore(std::shared_ptr<vespalib::alloc::MemoryAllocator> allocator, uint32_t max_small_buffer_type_id, double grow_factor); + static constexpr double array_store_grow_factor = 1.03; + static constexpr uint32_t array_store_max_type_id = 400; + static constexpr size_t max_buffer_size = vespalib::datastore::ArrayStoreConfig::default_max_buffer_size; + + RawBufferStore(std::shared_ptr<vespalib::alloc::MemoryAllocator> allocator, uint32_t max_type_id, double grow_factor); ~RawBufferStore(); EntryRef set(vespalib::ConstArrayRef<char> raw) { return _array_store.add(raw); }; vespalib::ConstArrayRef<char> get(EntryRef ref) const { return _array_store.get(ref); } diff --git a/searchlib/src/vespa/searchlib/attribute/single_raw_attribute.cpp b/searchlib/src/vespa/searchlib/attribute/single_raw_attribute.cpp index 9a514726985..ae77a6fa9c9 100644 --- a/searchlib/src/vespa/searchlib/attribute/single_raw_attribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/single_raw_attribute.cpp @@ -11,20 +11,12 @@ using vespalib::alloc::MemoryAllocator; using vespalib::datastore::EntryRef; -namespace { - -constexpr double mapper_grow_factor = 1.03; - -constexpr uint32_t max_small_buffer_type_id = 500u; - -} - namespace search::attribute { SingleRawAttribute::SingleRawAttribute(const vespalib::string& name, const Config& config) : RawAttribute(name, config), _ref_vector(config.getGrowStrategy(), getGenerationHolder()), - _raw_store(get_memory_allocator(), max_small_buffer_type_id, mapper_grow_factor) + _raw_store(get_memory_allocator(), RawBufferStore::array_store_max_type_id, RawBufferStore::array_store_grow_factor) { } |