From 60b628f977102f905b67f23d765cf19e49fa21db Mon Sep 17 00:00:00 2001 From: Tor Brede Vekterli Date: Thu, 23 May 2019 08:37:54 +0000 Subject: Move RcuVector and relevant support classes to vespalib Having RCU support available across all our C++ modules open up new opportunities for optimizations. This changes the following: - `RcuVector` moved from `searchlib` to `vespalib` - `MemoryUsage` moved from `searchlib` to `vespalib` - Introduce a simplified, more generic `GrowStrategy` in `vespalib` used by the moved `RcuVector` which does not have any notion of documents. Existing searchlib `GrowStrategy` gets a simple function to convert to this generic strategy. --- searchcommon/src/vespa/searchcommon/common/growstrategy.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'searchcommon') diff --git a/searchcommon/src/vespa/searchcommon/common/growstrategy.h b/searchcommon/src/vespa/searchcommon/common/growstrategy.h index 5af9f9f16fe..4194541b8e5 100644 --- a/searchcommon/src/vespa/searchcommon/common/growstrategy.h +++ b/searchcommon/src/vespa/searchcommon/common/growstrategy.h @@ -2,6 +2,7 @@ #pragma once +#include #include namespace search { @@ -38,6 +39,10 @@ public: void setDocsInitialCapacity(uint32_t v) { _docsInitialCapacity = v; } void setDocsGrowDelta(uint32_t v) { _docsGrowDelta = v; } + vespalib::GrowStrategy to_generic_strategy() const { + return vespalib::GrowStrategy(_docsInitialCapacity, _docsGrowFactor, _docsGrowDelta); + } + bool operator==(const GrowStrategy & rhs) const { return _docsInitialCapacity == rhs._docsInitialCapacity && _docsGrowFactor == rhs._docsGrowFactor && -- cgit v1.2.3