mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
MergingIterator uses autovector instead of vector
Summary: Use autovector in MergingIterator so that if there are 4 or less child iterators in it, iterator wrappers are inline, which is more likely to be cache friendly. Based on one test run with a shadow traffic of one product, it reduces CPU of MergingIterator::Seek() by half. Test Plan: make all check Reviewers: haobo, yhchiang, igor, dhruba Reviewed By: igor CC: leveldb Differential Revision: https://reviews.facebook.net/D18531
This commit is contained in:
@@ -20,6 +20,13 @@ class IteratorWrapper {
|
||||
explicit IteratorWrapper(Iterator* iter): iter_(nullptr) {
|
||||
Set(iter);
|
||||
}
|
||||
IteratorWrapper(const IteratorWrapper&) {
|
||||
// Iterator wrapper exclusively owns iter_ so it cannot be copied.
|
||||
// Didn't delete the function because vector<IteratorWrapper> requires
|
||||
// this function to compile.
|
||||
assert(false);
|
||||
}
|
||||
void operator=(const IteratorWrapper&) = delete;
|
||||
~IteratorWrapper() { delete iter_; }
|
||||
Iterator* iter() const { return iter_; }
|
||||
|
||||
@@ -35,7 +42,6 @@ class IteratorWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Iterator interface methods
|
||||
bool Valid() const { return valid_; }
|
||||
Slice key() const { assert(Valid()); return key_; }
|
||||
|
||||
Reference in New Issue
Block a user