diff options
author | Tor Brede Vekterli <vekterli@verizonmedia.com> | 2019-05-23 08:37:54 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@verizonmedia.com> | 2019-05-23 11:26:36 +0000 |
commit | 60b628f977102f905b67f23d765cf19e49fa21db (patch) | |
tree | 5e58abcb9cddb3385251a08a26d7b14e0f2167b1 /searchcommon | |
parent | bbc62a7d9f6a0ec4e0eaafff3213dfebc49898a8 (diff) |
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.
Diffstat (limited to 'searchcommon')
-rw-r--r-- | searchcommon/src/vespa/searchcommon/common/growstrategy.h | 5 |
1 files changed, 5 insertions, 0 deletions
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 <vespa/vespalib/util/growstrategy.h> #include <cstdint> 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 && |