diff options
author | Tor Egge <Tor.Egge@online.no> | 2023-06-27 14:40:45 +0200 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2023-06-27 14:40:45 +0200 |
commit | 505af4a5205e08b2afb7f7b04eeb1a0fb5c43abb (patch) | |
tree | 189a43fdafdf28982b0f2a8adc5e8bf3cc6dd5c3 | |
parent | ba76ac718571412b22662a8429fa8b31510d48a2 (diff) |
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) { } |