Line | Count | Source |
1 | | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. |
2 | | // This source code is licensed under both the GPLv2 (found in the |
3 | | // COPYING file in the root directory) and Apache 2.0 License |
4 | | // (found in the LICENSE.Apache file in the root directory). |
5 | | |
6 | | #pragma once |
7 | | |
8 | | #include <algorithm> |
9 | | #include <cstdint> |
10 | | #include <functional> |
11 | | |
12 | | #include "port/port.h" |
13 | | #include "util/autovector.h" |
14 | | |
15 | | namespace ROCKSDB_NAMESPACE { |
16 | | |
17 | | // Binary heap implementation optimized for use in multi-way merge sort. |
18 | | // Comparison to std::priority_queue: |
19 | | // - In libstdc++, std::priority_queue::pop() usually performs just over logN |
20 | | // comparisons but never fewer. |
21 | | // - std::priority_queue does not have a replace-top operation, requiring a |
22 | | // pop+push. If the replacement element is the new top, this requires |
23 | | // around 2logN comparisons. |
24 | | // - This heap's pop() uses a "schoolbook" downheap which requires up to ~2logN |
25 | | // comparisons. |
26 | | // - This heap provides a replace_top() operation which requires [1, 2logN] |
27 | | // comparisons. When the replacement element is also the new top, this |
28 | | // takes just 1 or 2 comparisons. |
29 | | // |
30 | | // The last property can yield an order-of-magnitude performance improvement |
31 | | // when merge-sorting real-world non-random data. If the merge operation is |
32 | | // likely to take chunks of elements from the same input stream, only 1 |
33 | | // comparison per element is needed. In RocksDB-land, this happens when |
34 | | // compacting a database where keys are not randomly distributed across L0 |
35 | | // files but nearby keys are likely to be in the same L0 file. |
36 | | // |
37 | | // The container uses the same counterintuitive ordering as |
38 | | // std::priority_queue: the comparison operator is expected to provide the |
39 | | // less-than relation, but top() will return the maximum. |
40 | | |
41 | | template <typename T, typename Compare = std::less<T>> |
42 | | class BinaryHeap { |
43 | | public: |
44 | 0 | BinaryHeap() {} |
45 | 93.9k | explicit BinaryHeap(Compare cmp) : cmp_(std::move(cmp)) {}Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> > >::BinaryHeap(rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> >) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> > >::BinaryHeap(rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> >) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> > >::BinaryHeap(rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> >) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> > >::BinaryHeap(rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> >) rocksdb::BinaryHeap<std::__1::__tree_const_iterator<rocksdb::TruncatedRangeDelIterator*, std::__1::__tree_node<rocksdb::TruncatedRangeDelIterator*, void*>*, long>, rocksdb::ForwardRangeDelIterator::EndKeyMinComparator>::BinaryHeap(rocksdb::ForwardRangeDelIterator::EndKeyMinComparator) Line | Count | Source | 45 | 13.7k | explicit BinaryHeap(Compare cmp) : cmp_(std::move(cmp)) {} |
rocksdb::BinaryHeap<rocksdb::TruncatedRangeDelIterator*, rocksdb::StartKeyMinComparator>::BinaryHeap(rocksdb::StartKeyMinComparator) Line | Count | Source | 45 | 30.3k | explicit BinaryHeap(Compare cmp) : cmp_(std::move(cmp)) {} |
rocksdb::BinaryHeap<std::__1::__tree_const_iterator<rocksdb::TruncatedRangeDelIterator*, std::__1::__tree_node<rocksdb::TruncatedRangeDelIterator*, void*>*, long>, rocksdb::ReverseRangeDelIterator::StartKeyMaxComparator>::BinaryHeap(rocksdb::ReverseRangeDelIterator::StartKeyMaxComparator) Line | Count | Source | 45 | 13.7k | explicit BinaryHeap(Compare cmp) : cmp_(std::move(cmp)) {} |
rocksdb::BinaryHeap<rocksdb::TruncatedRangeDelIterator*, rocksdb::ReverseRangeDelIterator::EndKeyMaxComparator>::BinaryHeap(rocksdb::ReverseRangeDelIterator::EndKeyMaxComparator) Line | Count | Source | 45 | 13.7k | explicit BinaryHeap(Compare cmp) : cmp_(std::move(cmp)) {} |
rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MinHeapItemComparator>::BinaryHeap(rocksdb::MergingIterator::MinHeapItemComparator) Line | Count | Source | 45 | 16.3k | explicit BinaryHeap(Compare cmp) : cmp_(std::move(cmp)) {} |
rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MaxHeapItemComparator>::BinaryHeap(rocksdb::MergingIterator::MaxHeapItemComparator) Line | Count | Source | 45 | 2.50k | explicit BinaryHeap(Compare cmp) : cmp_(std::move(cmp)) {} |
rocksdb::BinaryHeap<rocksdb::CompactionMergingIterator::HeapItem*, rocksdb::CompactionMergingIterator::CompactionHeapItemComparator>::BinaryHeap(rocksdb::CompactionMergingIterator::CompactionHeapItemComparator) Line | Count | Source | 45 | 3.42k | explicit BinaryHeap(Compare cmp) : cmp_(std::move(cmp)) {} |
|
46 | | |
47 | 54.8k | void push(const T& value) { |
48 | 54.8k | data_.push_back(value); |
49 | 54.8k | upheap(data_.size() - 1); |
50 | 54.8k | } Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> > >::push(rocksdb::MultiCfIteratorInfo const&) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> > >::push(rocksdb::MultiCfIteratorInfo const&) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> > >::push(rocksdb::MultiCfIteratorInfo const&) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> > >::push(rocksdb::MultiCfIteratorInfo const&) rocksdb::BinaryHeap<std::__1::__tree_const_iterator<rocksdb::TruncatedRangeDelIterator*, std::__1::__tree_node<rocksdb::TruncatedRangeDelIterator*, void*>*, long>, rocksdb::ForwardRangeDelIterator::EndKeyMinComparator>::push(std::__1::__tree_const_iterator<rocksdb::TruncatedRangeDelIterator*, std::__1::__tree_node<rocksdb::TruncatedRangeDelIterator*, void*>*, long> const&) Line | Count | Source | 47 | 18.0k | void push(const T& value) { | 48 | 18.0k | data_.push_back(value); | 49 | 18.0k | upheap(data_.size() - 1); | 50 | 18.0k | } |
rocksdb::BinaryHeap<rocksdb::TruncatedRangeDelIterator*, rocksdb::StartKeyMinComparator>::push(rocksdb::TruncatedRangeDelIterator* const&) Line | Count | Source | 47 | 7.85k | void push(const T& value) { | 48 | 7.85k | data_.push_back(value); | 49 | 7.85k | upheap(data_.size() - 1); | 50 | 7.85k | } |
Unexecuted instantiation: rocksdb::BinaryHeap<std::__1::__tree_const_iterator<rocksdb::TruncatedRangeDelIterator*, std::__1::__tree_node<rocksdb::TruncatedRangeDelIterator*, void*>*, long>, rocksdb::ReverseRangeDelIterator::StartKeyMaxComparator>::push(std::__1::__tree_const_iterator<rocksdb::TruncatedRangeDelIterator*, std::__1::__tree_node<rocksdb::TruncatedRangeDelIterator*, void*>*, long> const&) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::TruncatedRangeDelIterator*, rocksdb::ReverseRangeDelIterator::EndKeyMaxComparator>::push(rocksdb::TruncatedRangeDelIterator* const&) rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MinHeapItemComparator>::push(rocksdb::MergingIterator::HeapItem* const&) Line | Count | Source | 47 | 10.3k | void push(const T& value) { | 48 | 10.3k | data_.push_back(value); | 49 | 10.3k | upheap(data_.size() - 1); | 50 | 10.3k | } |
rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MaxHeapItemComparator>::push(rocksdb::MergingIterator::HeapItem* const&) Line | Count | Source | 47 | 6.72k | void push(const T& value) { | 48 | 6.72k | data_.push_back(value); | 49 | 6.72k | upheap(data_.size() - 1); | 50 | 6.72k | } |
rocksdb::BinaryHeap<rocksdb::CompactionMergingIterator::HeapItem*, rocksdb::CompactionMergingIterator::CompactionHeapItemComparator>::push(rocksdb::CompactionMergingIterator::HeapItem* const&) Line | Count | Source | 47 | 11.8k | void push(const T& value) { | 48 | 11.8k | data_.push_back(value); | 49 | 11.8k | upheap(data_.size() - 1); | 50 | 11.8k | } |
|
51 | | |
52 | 2.55k | void push(T&& value) { |
53 | 2.55k | data_.push_back(std::move(value)); |
54 | 2.55k | upheap(data_.size() - 1); |
55 | 2.55k | } Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> > >::push(rocksdb::MultiCfIteratorInfo&&) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> > >::push(rocksdb::MultiCfIteratorInfo&&) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> > >::push(rocksdb::MultiCfIteratorInfo&&) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> > >::push(rocksdb::MultiCfIteratorInfo&&) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::CoalescingIterator::WideColumnWithOrder, rocksdb::CoalescingIterator::WideColumnWithOrderComparator>::push(rocksdb::CoalescingIterator::WideColumnWithOrder&&) rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MinHeapItemComparator>::push(rocksdb::MergingIterator::HeapItem*&&) Line | Count | Source | 52 | 2.55k | void push(T&& value) { | 53 | 2.55k | data_.push_back(std::move(value)); | 54 | 2.55k | upheap(data_.size() - 1); | 55 | 2.55k | } |
Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MaxHeapItemComparator>::push(rocksdb::MergingIterator::HeapItem*&&) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::CompactionMergingIterator::HeapItem*, rocksdb::CompactionMergingIterator::CompactionHeapItemComparator>::push(rocksdb::CompactionMergingIterator::HeapItem*&&) |
56 | | |
57 | 134M | const T& top() const { |
58 | 134M | assert(!empty()); |
59 | 134M | return data_.front(); |
60 | 134M | } Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> > >::top() const Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> > >::top() const Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> > >::top() const Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> > >::top() const rocksdb::BinaryHeap<std::__1::__tree_const_iterator<rocksdb::TruncatedRangeDelIterator*, std::__1::__tree_node<rocksdb::TruncatedRangeDelIterator*, void*>*, long>, rocksdb::ForwardRangeDelIterator::EndKeyMinComparator>::top() const Line | Count | Source | 57 | 73.4k | const T& top() const { | 58 | | assert(!empty()); | 59 | 73.4k | return data_.front(); | 60 | 73.4k | } |
rocksdb::BinaryHeap<rocksdb::TruncatedRangeDelIterator*, rocksdb::StartKeyMinComparator>::top() const Line | Count | Source | 57 | 133M | const T& top() const { | 58 | | assert(!empty()); | 59 | 133M | return data_.front(); | 60 | 133M | } |
Unexecuted instantiation: rocksdb::BinaryHeap<std::__1::__tree_const_iterator<rocksdb::TruncatedRangeDelIterator*, std::__1::__tree_node<rocksdb::TruncatedRangeDelIterator*, void*>*, long>, rocksdb::ReverseRangeDelIterator::StartKeyMaxComparator>::top() const Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::TruncatedRangeDelIterator*, rocksdb::ReverseRangeDelIterator::EndKeyMaxComparator>::top() const Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::CoalescingIterator::WideColumnWithOrder, rocksdb::CoalescingIterator::WideColumnWithOrderComparator>::top() const rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MinHeapItemComparator>::top() const Line | Count | Source | 57 | 410k | const T& top() const { | 58 | | assert(!empty()); | 59 | 410k | return data_.front(); | 60 | 410k | } |
rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MaxHeapItemComparator>::top() const Line | Count | Source | 57 | 41.5k | const T& top() const { | 58 | | assert(!empty()); | 59 | 41.5k | return data_.front(); | 60 | 41.5k | } |
rocksdb::BinaryHeap<rocksdb::CompactionMergingIterator::HeapItem*, rocksdb::CompactionMergingIterator::CompactionHeapItemComparator>::top() const Line | Count | Source | 57 | 20.1k | const T& top() const { | 58 | | assert(!empty()); | 59 | 20.1k | return data_.front(); | 60 | 20.1k | } |
|
61 | | |
62 | 26.8M | void replace_top(const T& value) { |
63 | 26.8M | assert(!empty()); |
64 | 26.8M | data_.front() = value; |
65 | 26.8M | downheap(get_root()); |
66 | 26.8M | } Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> > >::replace_top(rocksdb::MultiCfIteratorInfo const&) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> > >::replace_top(rocksdb::MultiCfIteratorInfo const&) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> > >::replace_top(rocksdb::MultiCfIteratorInfo const&) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> > >::replace_top(rocksdb::MultiCfIteratorInfo const&) rocksdb::BinaryHeap<rocksdb::TruncatedRangeDelIterator*, rocksdb::StartKeyMinComparator>::replace_top(rocksdb::TruncatedRangeDelIterator* const&) Line | Count | Source | 62 | 26.7M | void replace_top(const T& value) { | 63 | | assert(!empty()); | 64 | 26.7M | data_.front() = value; | 65 | 26.7M | downheap(get_root()); | 66 | 26.7M | } |
rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MinHeapItemComparator>::replace_top(rocksdb::MergingIterator::HeapItem* const&) Line | Count | Source | 62 | 24.2k | void replace_top(const T& value) { | 63 | | assert(!empty()); | 64 | 24.2k | data_.front() = value; | 65 | 24.2k | downheap(get_root()); | 66 | 24.2k | } |
rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MaxHeapItemComparator>::replace_top(rocksdb::MergingIterator::HeapItem* const&) Line | Count | Source | 62 | 5.04k | void replace_top(const T& value) { | 63 | | assert(!empty()); | 64 | 5.04k | data_.front() = value; | 65 | 5.04k | downheap(get_root()); | 66 | 5.04k | } |
rocksdb::BinaryHeap<rocksdb::CompactionMergingIterator::HeapItem*, rocksdb::CompactionMergingIterator::CompactionHeapItemComparator>::replace_top(rocksdb::CompactionMergingIterator::HeapItem* const&) Line | Count | Source | 62 | 4.41k | void replace_top(const T& value) { | 63 | | assert(!empty()); | 64 | 4.41k | data_.front() = value; | 65 | 4.41k | downheap(get_root()); | 66 | 4.41k | } |
|
67 | | |
68 | 140k | void replace_top(T&& value) { |
69 | 140k | assert(!empty()); |
70 | 140k | data_.front() = std::move(value); |
71 | 140k | downheap(get_root()); |
72 | 140k | } rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MinHeapItemComparator>::replace_top(rocksdb::MergingIterator::HeapItem*&&) Line | Count | Source | 68 | 140k | void replace_top(T&& value) { | 69 | | assert(!empty()); | 70 | 140k | data_.front() = std::move(value); | 71 | 140k | downheap(get_root()); | 72 | 140k | } |
Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MaxHeapItemComparator>::replace_top(rocksdb::MergingIterator::HeapItem*&&) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::CompactionMergingIterator::HeapItem*, rocksdb::CompactionMergingIterator::CompactionHeapItemComparator>::replace_top(rocksdb::CompactionMergingIterator::HeapItem*&&) |
73 | | |
74 | 48.1k | void pop() { |
75 | 48.1k | assert(!empty()); |
76 | 48.1k | if (data_.size() > 1) { |
77 | | // Avoid self-move-assign, because it could cause problems with |
78 | | // classes which are not prepared for this and it trips up the |
79 | | // STL debugger when activated. |
80 | 12.6k | data_.front() = std::move(data_.back()); |
81 | 12.6k | } |
82 | 48.1k | data_.pop_back(); |
83 | 48.1k | if (!empty()) { |
84 | 12.6k | downheap(get_root()); |
85 | 35.4k | } else { |
86 | 35.4k | reset_root_cmp_cache(); |
87 | 35.4k | } |
88 | 48.1k | } Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> > >::pop() Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> > >::pop() Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> > >::pop() Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> > >::pop() rocksdb::BinaryHeap<std::__1::__tree_const_iterator<rocksdb::TruncatedRangeDelIterator*, std::__1::__tree_node<rocksdb::TruncatedRangeDelIterator*, void*>*, long>, rocksdb::ForwardRangeDelIterator::EndKeyMinComparator>::pop() Line | Count | Source | 74 | 16.9k | void pop() { | 75 | 16.9k | assert(!empty()); | 76 | 16.9k | if (data_.size() > 1) { | 77 | | // Avoid self-move-assign, because it could cause problems with | 78 | | // classes which are not prepared for this and it trips up the | 79 | | // STL debugger when activated. | 80 | 0 | data_.front() = std::move(data_.back()); | 81 | 0 | } | 82 | 16.9k | data_.pop_back(); | 83 | 16.9k | if (!empty()) { | 84 | 0 | downheap(get_root()); | 85 | 16.9k | } else { | 86 | 16.9k | reset_root_cmp_cache(); | 87 | 16.9k | } | 88 | 16.9k | } |
rocksdb::BinaryHeap<rocksdb::TruncatedRangeDelIterator*, rocksdb::StartKeyMinComparator>::pop() Line | Count | Source | 74 | 7.51k | void pop() { | 75 | 7.51k | assert(!empty()); | 76 | 7.51k | if (data_.size() > 1) { | 77 | | // Avoid self-move-assign, because it could cause problems with | 78 | | // classes which are not prepared for this and it trips up the | 79 | | // STL debugger when activated. | 80 | 0 | data_.front() = std::move(data_.back()); | 81 | 0 | } | 82 | 7.51k | data_.pop_back(); | 83 | 7.51k | if (!empty()) { | 84 | 0 | downheap(get_root()); | 85 | 7.51k | } else { | 86 | 7.51k | reset_root_cmp_cache(); | 87 | 7.51k | } | 88 | 7.51k | } |
Unexecuted instantiation: rocksdb::BinaryHeap<std::__1::__tree_const_iterator<rocksdb::TruncatedRangeDelIterator*, std::__1::__tree_node<rocksdb::TruncatedRangeDelIterator*, void*>*, long>, rocksdb::ReverseRangeDelIterator::StartKeyMaxComparator>::pop() Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::TruncatedRangeDelIterator*, rocksdb::ReverseRangeDelIterator::EndKeyMaxComparator>::pop() Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::CoalescingIterator::WideColumnWithOrder, rocksdb::CoalescingIterator::WideColumnWithOrderComparator>::pop() rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MinHeapItemComparator>::pop() Line | Count | Source | 74 | 11.5k | void pop() { | 75 | 11.5k | assert(!empty()); | 76 | 11.5k | if (data_.size() > 1) { | 77 | | // Avoid self-move-assign, because it could cause problems with | 78 | | // classes which are not prepared for this and it trips up the | 79 | | // STL debugger when activated. | 80 | 5.38k | data_.front() = std::move(data_.back()); | 81 | 5.38k | } | 82 | 11.5k | data_.pop_back(); | 83 | 11.5k | if (!empty()) { | 84 | 5.38k | downheap(get_root()); | 85 | 6.19k | } else { | 86 | 6.19k | reset_root_cmp_cache(); | 87 | 6.19k | } | 88 | 11.5k | } |
rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MaxHeapItemComparator>::pop() Line | Count | Source | 74 | 6.34k | void pop() { | 75 | 6.34k | assert(!empty()); | 76 | 6.34k | if (data_.size() > 1) { | 77 | | // Avoid self-move-assign, because it could cause problems with | 78 | | // classes which are not prepared for this and it trips up the | 79 | | // STL debugger when activated. | 80 | 3.77k | data_.front() = std::move(data_.back()); | 81 | 3.77k | } | 82 | 6.34k | data_.pop_back(); | 83 | 6.34k | if (!empty()) { | 84 | 3.77k | downheap(get_root()); | 85 | 3.77k | } else { | 86 | 2.57k | reset_root_cmp_cache(); | 87 | 2.57k | } | 88 | 6.34k | } |
rocksdb::BinaryHeap<rocksdb::CompactionMergingIterator::HeapItem*, rocksdb::CompactionMergingIterator::CompactionHeapItemComparator>::pop() Line | Count | Source | 74 | 5.72k | void pop() { | 75 | 5.72k | assert(!empty()); | 76 | 5.72k | if (data_.size() > 1) { | 77 | | // Avoid self-move-assign, because it could cause problems with | 78 | | // classes which are not prepared for this and it trips up the | 79 | | // STL debugger when activated. | 80 | 3.51k | data_.front() = std::move(data_.back()); | 81 | 3.51k | } | 82 | 5.72k | data_.pop_back(); | 83 | 5.72k | if (!empty()) { | 84 | 3.51k | downheap(get_root()); | 85 | 3.51k | } else { | 86 | 2.21k | reset_root_cmp_cache(); | 87 | 2.21k | } | 88 | 5.72k | } |
|
89 | | |
90 | | void swap(BinaryHeap& other) { |
91 | | std::swap(cmp_, other.cmp_); |
92 | | data_.swap(other.data_); |
93 | | std::swap(root_cmp_cache_, other.root_cmp_cache_); |
94 | | } |
95 | | |
96 | 158k | void clear() { |
97 | 158k | data_.clear(); |
98 | 158k | reset_root_cmp_cache(); |
99 | 158k | } Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> > >::clear() Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> > >::clear() Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> > >::clear() Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> > >::clear() rocksdb::BinaryHeap<std::__1::__tree_const_iterator<rocksdb::TruncatedRangeDelIterator*, std::__1::__tree_node<rocksdb::TruncatedRangeDelIterator*, void*>*, long>, rocksdb::ForwardRangeDelIterator::EndKeyMinComparator>::clear() Line | Count | Source | 96 | 2.55k | void clear() { | 97 | 2.55k | data_.clear(); | 98 | 2.55k | reset_root_cmp_cache(); | 99 | 2.55k | } |
rocksdb::BinaryHeap<rocksdb::TruncatedRangeDelIterator*, rocksdb::StartKeyMinComparator>::clear() Line | Count | Source | 96 | 35.6k | void clear() { | 97 | 35.6k | data_.clear(); | 98 | 35.6k | reset_root_cmp_cache(); | 99 | 35.6k | } |
rocksdb::BinaryHeap<std::__1::__tree_const_iterator<rocksdb::TruncatedRangeDelIterator*, std::__1::__tree_node<rocksdb::TruncatedRangeDelIterator*, void*>*, long>, rocksdb::ReverseRangeDelIterator::StartKeyMaxComparator>::clear() Line | Count | Source | 96 | 53.7k | void clear() { | 97 | 53.7k | data_.clear(); | 98 | 53.7k | reset_root_cmp_cache(); | 99 | 53.7k | } |
rocksdb::BinaryHeap<rocksdb::TruncatedRangeDelIterator*, rocksdb::ReverseRangeDelIterator::EndKeyMaxComparator>::clear() Line | Count | Source | 96 | 53.7k | void clear() { | 97 | 53.7k | data_.clear(); | 98 | 53.7k | reset_root_cmp_cache(); | 99 | 53.7k | } |
rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MinHeapItemComparator>::clear() Line | Count | Source | 96 | 8.87k | void clear() { | 97 | 8.87k | data_.clear(); | 98 | 8.87k | reset_root_cmp_cache(); | 99 | 8.87k | } |
rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MaxHeapItemComparator>::clear() Line | Count | Source | 96 | 566 | void clear() { | 97 | 566 | data_.clear(); | 98 | 566 | reset_root_cmp_cache(); | 99 | 566 | } |
rocksdb::BinaryHeap<rocksdb::CompactionMergingIterator::HeapItem*, rocksdb::CompactionMergingIterator::CompactionHeapItemComparator>::clear() Line | Count | Source | 96 | 3.42k | void clear() { | 97 | 3.42k | data_.clear(); | 98 | 3.42k | reset_root_cmp_cache(); | 99 | 3.42k | } |
|
100 | | |
101 | 27.3M | bool empty() const { return data_.empty(); }Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> > >::empty() const Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> > >::empty() const Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> > >::empty() const Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> > >::empty() const rocksdb::BinaryHeap<std::__1::__tree_const_iterator<rocksdb::TruncatedRangeDelIterator*, std::__1::__tree_node<rocksdb::TruncatedRangeDelIterator*, void*>*, long>, rocksdb::ForwardRangeDelIterator::EndKeyMinComparator>::empty() const Line | Count | Source | 101 | 85.2k | bool empty() const { return data_.empty(); } |
rocksdb::BinaryHeap<rocksdb::TruncatedRangeDelIterator*, rocksdb::StartKeyMinComparator>::empty() const Line | Count | Source | 101 | 26.8M | bool empty() const { return data_.empty(); } |
Unexecuted instantiation: rocksdb::BinaryHeap<std::__1::__tree_const_iterator<rocksdb::TruncatedRangeDelIterator*, std::__1::__tree_node<rocksdb::TruncatedRangeDelIterator*, void*>*, long>, rocksdb::ReverseRangeDelIterator::StartKeyMaxComparator>::empty() const Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::TruncatedRangeDelIterator*, rocksdb::ReverseRangeDelIterator::EndKeyMaxComparator>::empty() const Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::CoalescingIterator::WideColumnWithOrder, rocksdb::CoalescingIterator::WideColumnWithOrderComparator>::empty() const rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MinHeapItemComparator>::empty() const Line | Count | Source | 101 | 341k | bool empty() const { return data_.empty(); } |
rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MaxHeapItemComparator>::empty() const Line | Count | Source | 101 | 48.3k | bool empty() const { return data_.empty(); } |
rocksdb::BinaryHeap<rocksdb::CompactionMergingIterator::HeapItem*, rocksdb::CompactionMergingIterator::CompactionHeapItemComparator>::empty() const Line | Count | Source | 101 | 30.3k | bool empty() const { return data_.empty(); } |
|
102 | | |
103 | 0 | size_t size() const { return data_.size(); } |
104 | | |
105 | 265k | void reset_root_cmp_cache() { |
106 | 265k | root_cmp_cache_ = std::numeric_limits<size_t>::max(); |
107 | 265k | } Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> > >::reset_root_cmp_cache() Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> > >::reset_root_cmp_cache() Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> > >::reset_root_cmp_cache() Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> > >::reset_root_cmp_cache() rocksdb::BinaryHeap<std::__1::__tree_const_iterator<rocksdb::TruncatedRangeDelIterator*, std::__1::__tree_node<rocksdb::TruncatedRangeDelIterator*, void*>*, long>, rocksdb::ForwardRangeDelIterator::EndKeyMinComparator>::reset_root_cmp_cache() Line | Count | Source | 105 | 37.6k | void reset_root_cmp_cache() { | 106 | 37.6k | root_cmp_cache_ = std::numeric_limits<size_t>::max(); | 107 | 37.6k | } |
rocksdb::BinaryHeap<rocksdb::TruncatedRangeDelIterator*, rocksdb::StartKeyMinComparator>::reset_root_cmp_cache() Line | Count | Source | 105 | 50.9k | void reset_root_cmp_cache() { | 106 | 50.9k | root_cmp_cache_ = std::numeric_limits<size_t>::max(); | 107 | 50.9k | } |
rocksdb::BinaryHeap<std::__1::__tree_const_iterator<rocksdb::TruncatedRangeDelIterator*, std::__1::__tree_node<rocksdb::TruncatedRangeDelIterator*, void*>*, long>, rocksdb::ReverseRangeDelIterator::StartKeyMaxComparator>::reset_root_cmp_cache() Line | Count | Source | 105 | 53.7k | void reset_root_cmp_cache() { | 106 | 53.7k | root_cmp_cache_ = std::numeric_limits<size_t>::max(); | 107 | 53.7k | } |
rocksdb::BinaryHeap<rocksdb::TruncatedRangeDelIterator*, rocksdb::ReverseRangeDelIterator::EndKeyMaxComparator>::reset_root_cmp_cache() Line | Count | Source | 105 | 53.7k | void reset_root_cmp_cache() { | 106 | 53.7k | root_cmp_cache_ = std::numeric_limits<size_t>::max(); | 107 | 53.7k | } |
Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::CoalescingIterator::WideColumnWithOrder, rocksdb::CoalescingIterator::WideColumnWithOrderComparator>::reset_root_cmp_cache() rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MinHeapItemComparator>::reset_root_cmp_cache() Line | Count | Source | 105 | 39.0k | void reset_root_cmp_cache() { | 106 | 39.0k | root_cmp_cache_ = std::numeric_limits<size_t>::max(); | 107 | 39.0k | } |
rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MaxHeapItemComparator>::reset_root_cmp_cache() Line | Count | Source | 105 | 10.7k | void reset_root_cmp_cache() { | 106 | 10.7k | root_cmp_cache_ = std::numeric_limits<size_t>::max(); | 107 | 10.7k | } |
rocksdb::BinaryHeap<rocksdb::CompactionMergingIterator::HeapItem*, rocksdb::CompactionMergingIterator::CompactionHeapItemComparator>::reset_root_cmp_cache() Line | Count | Source | 105 | 19.8k | void reset_root_cmp_cache() { | 106 | 19.8k | root_cmp_cache_ = std::numeric_limits<size_t>::max(); | 107 | 19.8k | } |
|
108 | | |
109 | | private: |
110 | 27.0M | static inline size_t get_root() { return 0; }Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> > >::get_root() Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> > >::get_root() Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> > >::get_root() Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> > >::get_root() rocksdb::BinaryHeap<std::__1::__tree_const_iterator<rocksdb::TruncatedRangeDelIterator*, std::__1::__tree_node<rocksdb::TruncatedRangeDelIterator*, void*>*, long>, rocksdb::ForwardRangeDelIterator::EndKeyMinComparator>::get_root() Line | Count | Source | 110 | 18.0k | static inline size_t get_root() { return 0; } |
rocksdb::BinaryHeap<rocksdb::TruncatedRangeDelIterator*, rocksdb::StartKeyMinComparator>::get_root() Line | Count | Source | 110 | 26.7M | static inline size_t get_root() { return 0; } |
Unexecuted instantiation: rocksdb::BinaryHeap<std::__1::__tree_const_iterator<rocksdb::TruncatedRangeDelIterator*, std::__1::__tree_node<rocksdb::TruncatedRangeDelIterator*, void*>*, long>, rocksdb::ReverseRangeDelIterator::StartKeyMaxComparator>::get_root() Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::TruncatedRangeDelIterator*, rocksdb::ReverseRangeDelIterator::EndKeyMaxComparator>::get_root() Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::CoalescingIterator::WideColumnWithOrder, rocksdb::CoalescingIterator::WideColumnWithOrderComparator>::get_root() rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MinHeapItemComparator>::get_root() Line | Count | Source | 110 | 184k | static inline size_t get_root() { return 0; } |
rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MaxHeapItemComparator>::get_root() Line | Count | Source | 110 | 20.3k | static inline size_t get_root() { return 0; } |
rocksdb::BinaryHeap<rocksdb::CompactionMergingIterator::HeapItem*, rocksdb::CompactionMergingIterator::CompactionHeapItemComparator>::get_root() Line | Count | Source | 110 | 19.9k | static inline size_t get_root() { return 0; } |
|
111 | 19.8k | static inline size_t get_parent(size_t index) { return (index - 1) / 2; }Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> > >::get_parent(unsigned long) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> > >::get_parent(unsigned long) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> > >::get_parent(unsigned long) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> > >::get_parent(unsigned long) Unexecuted instantiation: rocksdb::BinaryHeap<std::__1::__tree_const_iterator<rocksdb::TruncatedRangeDelIterator*, std::__1::__tree_node<rocksdb::TruncatedRangeDelIterator*, void*>*, long>, rocksdb::ForwardRangeDelIterator::EndKeyMinComparator>::get_parent(unsigned long) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::TruncatedRangeDelIterator*, rocksdb::StartKeyMinComparator>::get_parent(unsigned long) Unexecuted instantiation: rocksdb::BinaryHeap<std::__1::__tree_const_iterator<rocksdb::TruncatedRangeDelIterator*, std::__1::__tree_node<rocksdb::TruncatedRangeDelIterator*, void*>*, long>, rocksdb::ReverseRangeDelIterator::StartKeyMaxComparator>::get_parent(unsigned long) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::TruncatedRangeDelIterator*, rocksdb::ReverseRangeDelIterator::EndKeyMaxComparator>::get_parent(unsigned long) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::CoalescingIterator::WideColumnWithOrder, rocksdb::CoalescingIterator::WideColumnWithOrderComparator>::get_parent(unsigned long) rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MinHeapItemComparator>::get_parent(unsigned long) Line | Count | Source | 111 | 6.46k | static inline size_t get_parent(size_t index) { return (index - 1) / 2; } |
rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MaxHeapItemComparator>::get_parent(unsigned long) Line | Count | Source | 111 | 4.86k | static inline size_t get_parent(size_t index) { return (index - 1) / 2; } |
rocksdb::BinaryHeap<rocksdb::CompactionMergingIterator::HeapItem*, rocksdb::CompactionMergingIterator::CompactionHeapItemComparator>::get_parent(unsigned long) Line | Count | Source | 111 | 8.50k | static inline size_t get_parent(size_t index) { return (index - 1) / 2; } |
|
112 | 53.9M | static inline size_t get_left(size_t index) { return 2 * index + 1; }Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> > >::get_left(unsigned long) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> > >::get_left(unsigned long) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> > >::get_left(unsigned long) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> > >::get_left(unsigned long) Unexecuted instantiation: rocksdb::BinaryHeap<std::__1::__tree_const_iterator<rocksdb::TruncatedRangeDelIterator*, std::__1::__tree_node<rocksdb::TruncatedRangeDelIterator*, void*>*, long>, rocksdb::ForwardRangeDelIterator::EndKeyMinComparator>::get_left(unsigned long) rocksdb::BinaryHeap<rocksdb::TruncatedRangeDelIterator*, rocksdb::StartKeyMinComparator>::get_left(unsigned long) Line | Count | Source | 112 | 53.5M | static inline size_t get_left(size_t index) { return 2 * index + 1; } |
Unexecuted instantiation: rocksdb::BinaryHeap<std::__1::__tree_const_iterator<rocksdb::TruncatedRangeDelIterator*, std::__1::__tree_node<rocksdb::TruncatedRangeDelIterator*, void*>*, long>, rocksdb::ReverseRangeDelIterator::StartKeyMaxComparator>::get_left(unsigned long) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::TruncatedRangeDelIterator*, rocksdb::ReverseRangeDelIterator::EndKeyMaxComparator>::get_left(unsigned long) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::CoalescingIterator::WideColumnWithOrder, rocksdb::CoalescingIterator::WideColumnWithOrderComparator>::get_left(unsigned long) rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MinHeapItemComparator>::get_left(unsigned long) Line | Count | Source | 112 | 362k | static inline size_t get_left(size_t index) { return 2 * index + 1; } |
rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MaxHeapItemComparator>::get_left(unsigned long) Line | Count | Source | 112 | 19.6k | static inline size_t get_left(size_t index) { return 2 * index + 1; } |
rocksdb::BinaryHeap<rocksdb::CompactionMergingIterator::HeapItem*, rocksdb::CompactionMergingIterator::CompactionHeapItemComparator>::get_left(unsigned long) Line | Count | Source | 112 | 22.4k | static inline size_t get_left(size_t index) { return 2 * index + 1; } |
|
113 | | static inline size_t get_right(size_t index) { return 2 * index + 2; } |
114 | | |
115 | 57.4k | void upheap(size_t index) { |
116 | 57.4k | T v = std::move(data_[index]); |
117 | 63.9k | while (index > get_root()) { |
118 | 19.8k | const size_t parent = get_parent(index); |
119 | 19.8k | if (!cmp_(data_[parent], v)) { |
120 | 13.2k | break; |
121 | 13.2k | } |
122 | 6.54k | data_[index] = std::move(data_[parent]); |
123 | 6.54k | index = parent; |
124 | 6.54k | } |
125 | 57.4k | data_[index] = std::move(v); |
126 | 57.4k | reset_root_cmp_cache(); |
127 | 57.4k | } Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> > >::upheap(unsigned long) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> > >::upheap(unsigned long) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> > >::upheap(unsigned long) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> > >::upheap(unsigned long) rocksdb::BinaryHeap<std::__1::__tree_const_iterator<rocksdb::TruncatedRangeDelIterator*, std::__1::__tree_node<rocksdb::TruncatedRangeDelIterator*, void*>*, long>, rocksdb::ForwardRangeDelIterator::EndKeyMinComparator>::upheap(unsigned long) Line | Count | Source | 115 | 18.0k | void upheap(size_t index) { | 116 | 18.0k | T v = std::move(data_[index]); | 117 | 18.0k | while (index > get_root()) { | 118 | 0 | const size_t parent = get_parent(index); | 119 | 0 | if (!cmp_(data_[parent], v)) { | 120 | 0 | break; | 121 | 0 | } | 122 | 0 | data_[index] = std::move(data_[parent]); | 123 | 0 | index = parent; | 124 | 0 | } | 125 | 18.0k | data_[index] = std::move(v); | 126 | 18.0k | reset_root_cmp_cache(); | 127 | 18.0k | } |
rocksdb::BinaryHeap<rocksdb::TruncatedRangeDelIterator*, rocksdb::StartKeyMinComparator>::upheap(unsigned long) Line | Count | Source | 115 | 7.85k | void upheap(size_t index) { | 116 | 7.85k | T v = std::move(data_[index]); | 117 | 7.85k | while (index > get_root()) { | 118 | 0 | const size_t parent = get_parent(index); | 119 | 0 | if (!cmp_(data_[parent], v)) { | 120 | 0 | break; | 121 | 0 | } | 122 | 0 | data_[index] = std::move(data_[parent]); | 123 | 0 | index = parent; | 124 | 0 | } | 125 | 7.85k | data_[index] = std::move(v); | 126 | 7.85k | reset_root_cmp_cache(); | 127 | 7.85k | } |
Unexecuted instantiation: rocksdb::BinaryHeap<std::__1::__tree_const_iterator<rocksdb::TruncatedRangeDelIterator*, std::__1::__tree_node<rocksdb::TruncatedRangeDelIterator*, void*>*, long>, rocksdb::ReverseRangeDelIterator::StartKeyMaxComparator>::upheap(unsigned long) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::TruncatedRangeDelIterator*, rocksdb::ReverseRangeDelIterator::EndKeyMaxComparator>::upheap(unsigned long) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::CoalescingIterator::WideColumnWithOrder, rocksdb::CoalescingIterator::WideColumnWithOrderComparator>::upheap(unsigned long) rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MinHeapItemComparator>::upheap(unsigned long) Line | Count | Source | 115 | 12.9k | void upheap(size_t index) { | 116 | 12.9k | T v = std::move(data_[index]); | 117 | 14.5k | while (index > get_root()) { | 118 | 6.46k | const size_t parent = get_parent(index); | 119 | 6.46k | if (!cmp_(data_[parent], v)) { | 120 | 4.85k | break; | 121 | 4.85k | } | 122 | 1.61k | data_[index] = std::move(data_[parent]); | 123 | 1.61k | index = parent; | 124 | 1.61k | } | 125 | 12.9k | data_[index] = std::move(v); | 126 | 12.9k | reset_root_cmp_cache(); | 127 | 12.9k | } |
rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MaxHeapItemComparator>::upheap(unsigned long) Line | Count | Source | 115 | 6.72k | void upheap(size_t index) { | 116 | 6.72k | T v = std::move(data_[index]); | 117 | 11.5k | while (index > get_root()) { | 118 | 4.86k | const size_t parent = get_parent(index); | 119 | 4.86k | if (!cmp_(data_[parent], v)) { | 120 | 46 | break; | 121 | 46 | } | 122 | 4.81k | data_[index] = std::move(data_[parent]); | 123 | 4.81k | index = parent; | 124 | 4.81k | } | 125 | 6.72k | data_[index] = std::move(v); | 126 | 6.72k | reset_root_cmp_cache(); | 127 | 6.72k | } |
rocksdb::BinaryHeap<rocksdb::CompactionMergingIterator::HeapItem*, rocksdb::CompactionMergingIterator::CompactionHeapItemComparator>::upheap(unsigned long) Line | Count | Source | 115 | 11.8k | void upheap(size_t index) { | 116 | 11.8k | T v = std::move(data_[index]); | 117 | 11.9k | while (index > get_root()) { | 118 | 8.50k | const size_t parent = get_parent(index); | 119 | 8.50k | if (!cmp_(data_[parent], v)) { | 120 | 8.38k | break; | 121 | 8.38k | } | 122 | 113 | data_[index] = std::move(data_[parent]); | 123 | 113 | index = parent; | 124 | 113 | } | 125 | 11.8k | data_[index] = std::move(v); | 126 | 11.8k | reset_root_cmp_cache(); | 127 | 11.8k | } |
|
128 | | |
129 | 26.9M | void downheap(size_t index) { |
130 | 26.9M | T v = std::move(data_[index]); |
131 | | |
132 | 26.9M | size_t picked_child = std::numeric_limits<size_t>::max(); |
133 | 26.9M | while (1) { |
134 | 26.9M | const size_t left_child = get_left(index); |
135 | 26.9M | if (get_left(index) >= data_.size()) { |
136 | 26.8M | break; |
137 | 26.8M | } |
138 | 107k | const size_t right_child = left_child + 1; |
139 | 107k | assert(right_child == get_right(index)); |
140 | 107k | picked_child = left_child; |
141 | 107k | if (index == 0 && root_cmp_cache_ < data_.size()) { |
142 | 86.8k | picked_child = root_cmp_cache_; |
143 | 86.8k | } else if (right_child < data_.size() && |
144 | 4.92k | cmp_(data_[left_child], data_[right_child])) { |
145 | 1.63k | picked_child = right_child; |
146 | 1.63k | } |
147 | 107k | if (!cmp_(v, data_[picked_child])) { |
148 | 92.2k | break; |
149 | 92.2k | } |
150 | 15.5k | data_[index] = std::move(data_[picked_child]); |
151 | 15.5k | index = picked_child; |
152 | 15.5k | } |
153 | | |
154 | 26.9M | if (index == 0) { |
155 | | // We did not change anything in the tree except for the value |
156 | | // of the root node, left and right child did not change, we can |
157 | | // cache that `picked_child` is the smallest child |
158 | | // so next time we compare againist it directly |
159 | 26.9M | root_cmp_cache_ = picked_child; |
160 | 26.9M | } else { |
161 | | // the tree changed, reset cache |
162 | 14.2k | reset_root_cmp_cache(); |
163 | 14.2k | } |
164 | | |
165 | 26.9M | data_[index] = std::move(v); |
166 | 26.9M | } Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> > >::downheap(unsigned long) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::CoalescingIterator::ResetFunc, rocksdb::CoalescingIterator::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> > >::downheap(unsigned long) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::greater<int> > >::downheap(unsigned long) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::MultiCfIteratorInfo, rocksdb::MultiCfIteratorImpl<rocksdb::AttributeGroupIteratorImpl::ResetFunc, rocksdb::AttributeGroupIteratorImpl::PopulateFunc>::MultiCfHeapItemComparator<std::__1::less<int> > >::downheap(unsigned long) Unexecuted instantiation: rocksdb::BinaryHeap<std::__1::__tree_const_iterator<rocksdb::TruncatedRangeDelIterator*, std::__1::__tree_node<rocksdb::TruncatedRangeDelIterator*, void*>*, long>, rocksdb::ForwardRangeDelIterator::EndKeyMinComparator>::downheap(unsigned long) rocksdb::BinaryHeap<rocksdb::TruncatedRangeDelIterator*, rocksdb::StartKeyMinComparator>::downheap(unsigned long) Line | Count | Source | 129 | 26.7M | void downheap(size_t index) { | 130 | 26.7M | T v = std::move(data_[index]); | 131 | | | 132 | 26.7M | size_t picked_child = std::numeric_limits<size_t>::max(); | 133 | 26.7M | while (1) { | 134 | 26.7M | const size_t left_child = get_left(index); | 135 | 26.7M | if (get_left(index) >= data_.size()) { | 136 | 26.7M | break; | 137 | 26.7M | } | 138 | 0 | const size_t right_child = left_child + 1; | 139 | 0 | assert(right_child == get_right(index)); | 140 | 0 | picked_child = left_child; | 141 | 0 | if (index == 0 && root_cmp_cache_ < data_.size()) { | 142 | 0 | picked_child = root_cmp_cache_; | 143 | 0 | } else if (right_child < data_.size() && | 144 | 0 | cmp_(data_[left_child], data_[right_child])) { | 145 | 0 | picked_child = right_child; | 146 | 0 | } | 147 | 0 | if (!cmp_(v, data_[picked_child])) { | 148 | 0 | break; | 149 | 0 | } | 150 | 0 | data_[index] = std::move(data_[picked_child]); | 151 | 0 | index = picked_child; | 152 | 0 | } | 153 | | | 154 | 26.7M | if (index == 0) { | 155 | | // We did not change anything in the tree except for the value | 156 | | // of the root node, left and right child did not change, we can | 157 | | // cache that `picked_child` is the smallest child | 158 | | // so next time we compare againist it directly | 159 | 26.7M | root_cmp_cache_ = picked_child; | 160 | 26.7M | } else { | 161 | | // the tree changed, reset cache | 162 | 0 | reset_root_cmp_cache(); | 163 | 0 | } | 164 | | | 165 | 26.7M | data_[index] = std::move(v); | 166 | 26.7M | } |
Unexecuted instantiation: rocksdb::BinaryHeap<std::__1::__tree_const_iterator<rocksdb::TruncatedRangeDelIterator*, std::__1::__tree_node<rocksdb::TruncatedRangeDelIterator*, void*>*, long>, rocksdb::ReverseRangeDelIterator::StartKeyMaxComparator>::downheap(unsigned long) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::TruncatedRangeDelIterator*, rocksdb::ReverseRangeDelIterator::EndKeyMaxComparator>::downheap(unsigned long) Unexecuted instantiation: rocksdb::BinaryHeap<rocksdb::CoalescingIterator::WideColumnWithOrder, rocksdb::CoalescingIterator::WideColumnWithOrderComparator>::downheap(unsigned long) rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MinHeapItemComparator>::downheap(unsigned long) Line | Count | Source | 129 | 169k | void downheap(size_t index) { | 130 | 169k | T v = std::move(data_[index]); | 131 | | | 132 | 169k | size_t picked_child = std::numeric_limits<size_t>::max(); | 133 | 181k | while (1) { | 134 | 181k | const size_t left_child = get_left(index); | 135 | 181k | if (get_left(index) >= data_.size()) { | 136 | 81.4k | break; | 137 | 81.4k | } | 138 | 99.7k | const size_t right_child = left_child + 1; | 139 | 99.7k | assert(right_child == get_right(index)); | 140 | 99.7k | picked_child = left_child; | 141 | 99.7k | if (index == 0 && root_cmp_cache_ < data_.size()) { | 142 | 86.0k | picked_child = root_cmp_cache_; | 143 | 86.0k | } else if (right_child < data_.size() && | 144 | 1.21k | cmp_(data_[left_child], data_[right_child])) { | 145 | 434 | picked_child = right_child; | 146 | 434 | } | 147 | 99.7k | if (!cmp_(v, data_[picked_child])) { | 148 | 88.3k | break; | 149 | 88.3k | } | 150 | 11.3k | data_[index] = std::move(data_[picked_child]); | 151 | 11.3k | index = picked_child; | 152 | 11.3k | } | 153 | | | 154 | 169k | if (index == 0) { | 155 | | // We did not change anything in the tree except for the value | 156 | | // of the root node, left and right child did not change, we can | 157 | | // cache that `picked_child` is the smallest child | 158 | | // so next time we compare againist it directly | 159 | 158k | root_cmp_cache_ = picked_child; | 160 | 158k | } else { | 161 | | // the tree changed, reset cache | 162 | 11.1k | reset_root_cmp_cache(); | 163 | 11.1k | } | 164 | | | 165 | 169k | data_[index] = std::move(v); | 166 | 169k | } |
rocksdb::BinaryHeap<rocksdb::MergingIterator::HeapItem*, rocksdb::MergingIterator::MaxHeapItemComparator>::downheap(unsigned long) Line | Count | Source | 129 | 8.81k | void downheap(size_t index) { | 130 | 8.81k | T v = std::move(data_[index]); | 131 | | | 132 | 8.81k | size_t picked_child = std::numeric_limits<size_t>::max(); | 133 | 9.80k | while (1) { | 134 | 9.80k | const size_t left_child = get_left(index); | 135 | 9.80k | if (get_left(index) >= data_.size()) { | 136 | 5.57k | break; | 137 | 5.57k | } | 138 | 4.23k | const size_t right_child = left_child + 1; | 139 | 4.23k | assert(right_child == get_right(index)); | 140 | 4.23k | picked_child = left_child; | 141 | 4.23k | if (index == 0 && root_cmp_cache_ < data_.size()) { | 142 | 534 | picked_child = root_cmp_cache_; | 143 | 3.70k | } else if (right_child < data_.size() && | 144 | 1.45k | cmp_(data_[left_child], data_[right_child])) { | 145 | 620 | picked_child = right_child; | 146 | 620 | } | 147 | 4.23k | if (!cmp_(v, data_[picked_child])) { | 148 | 3.24k | break; | 149 | 3.24k | } | 150 | 987 | data_[index] = std::move(data_[picked_child]); | 151 | 987 | index = picked_child; | 152 | 987 | } | 153 | | | 154 | 8.81k | if (index == 0) { | 155 | | // We did not change anything in the tree except for the value | 156 | | // of the root node, left and right child did not change, we can | 157 | | // cache that `picked_child` is the smallest child | 158 | | // so next time we compare againist it directly | 159 | 7.94k | root_cmp_cache_ = picked_child; | 160 | 7.94k | } else { | 161 | | // the tree changed, reset cache | 162 | 879 | reset_root_cmp_cache(); | 163 | 879 | } | 164 | | | 165 | 8.81k | data_[index] = std::move(v); | 166 | 8.81k | } |
rocksdb::BinaryHeap<rocksdb::CompactionMergingIterator::HeapItem*, rocksdb::CompactionMergingIterator::CompactionHeapItemComparator>::downheap(unsigned long) Line | Count | Source | 129 | 7.92k | void downheap(size_t index) { | 130 | 7.92k | T v = std::move(data_[index]); | 131 | | | 132 | 7.92k | size_t picked_child = std::numeric_limits<size_t>::max(); | 133 | 11.2k | while (1) { | 134 | 11.2k | const size_t left_child = get_left(index); | 135 | 11.2k | if (get_left(index) >= data_.size()) { | 136 | 7.35k | break; | 137 | 7.35k | } | 138 | 3.84k | const size_t right_child = left_child + 1; | 139 | 3.84k | assert(right_child == get_right(index)); | 140 | 3.84k | picked_child = left_child; | 141 | 3.84k | if (index == 0 && root_cmp_cache_ < data_.size()) { | 142 | 228 | picked_child = root_cmp_cache_; | 143 | 3.61k | } else if (right_child < data_.size() && | 144 | 2.25k | cmp_(data_[left_child], data_[right_child])) { | 145 | 584 | picked_child = right_child; | 146 | 584 | } | 147 | 3.84k | if (!cmp_(v, data_[picked_child])) { | 148 | 572 | break; | 149 | 572 | } | 150 | 3.27k | data_[index] = std::move(data_[picked_child]); | 151 | 3.27k | index = picked_child; | 152 | 3.27k | } | 153 | | | 154 | 7.92k | if (index == 0) { | 155 | | // We did not change anything in the tree except for the value | 156 | | // of the root node, left and right child did not change, we can | 157 | | // cache that `picked_child` is the smallest child | 158 | | // so next time we compare againist it directly | 159 | 5.64k | root_cmp_cache_ = picked_child; | 160 | 5.64k | } else { | 161 | | // the tree changed, reset cache | 162 | 2.28k | reset_root_cmp_cache(); | 163 | 2.28k | } | 164 | | | 165 | 7.92k | data_[index] = std::move(v); | 166 | 7.92k | } |
|
167 | | |
168 | | Compare cmp_; |
169 | | autovector<T> data_; |
170 | | // Used to reduce number of cmp_ calls in downheap() |
171 | | size_t root_cmp_cache_ = std::numeric_limits<size_t>::max(); |
172 | | }; |
173 | | |
174 | | } // namespace ROCKSDB_NAMESPACE |