diff options
author | Geir Storli <geirst@oath.com> | 2018-01-19 14:18:57 +0000 |
---|---|---|
committer | Geir Storli <geirst@oath.com> | 2018-01-19 14:18:57 +0000 |
commit | eac3947f1275207660547f040b69127c18c08bff (patch) | |
tree | f403ed62c7f874ebb33dd063d5e03fb56cda6247 /searchlib/src/tests/datastore/array_store/array_store_test.cpp | |
parent | c8f67aeeb1bb0acb996af6cc6abb9becda074272 (diff) |
Add more conservative buffer allocation strategy in datastore buffers.
This should greatly reduce the memory footprint of multi-value attribute vectors
which uses an array store for underlying values.
The size of a new buffer is calculated as (simplified):
*) before: (size of previous buffer) * 2
*) now: (size of all previous buffers) * allocation grow factor (default = 0.2)
In addition we now support resizing of all buffers, not only the first one.
Diffstat (limited to 'searchlib/src/tests/datastore/array_store/array_store_test.cpp')
-rw-r--r-- | searchlib/src/tests/datastore/array_store/array_store_test.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/searchlib/src/tests/datastore/array_store/array_store_test.cpp b/searchlib/src/tests/datastore/array_store/array_store_test.cpp index 08559ed213f..fff4445890b 100644 --- a/searchlib/src/tests/datastore/array_store/array_store_test.cpp +++ b/searchlib/src/tests/datastore/array_store/array_store_test.cpp @@ -13,6 +13,8 @@ using vespalib::ArrayRef; using generation_t = vespalib::GenerationHandler::generation_t; using MemStats = search::datastore::test::MemStats; +constexpr float ALLOC_GROW_FACTOR = 0.2; + template <typename EntryT, typename RefT = EntryRefT<19> > struct Fixture { @@ -28,7 +30,9 @@ struct Fixture ReferenceStore refStore; generation_t generation; Fixture(uint32_t maxSmallArraySize) - : store(ArrayStoreConfig(maxSmallArraySize, ArrayStoreConfig::AllocSpec(16, RefT::offsetSize(), 8 * 1024))), + : store(ArrayStoreConfig(maxSmallArraySize, + ArrayStoreConfig::AllocSpec(16, RefT::offsetSize(), 8 * 1024, + ALLOC_GROW_FACTOR))), refStore(), generation(1) {} |