diff options
author | Yuhong Zhang <danielzhangyh@gmail.com> | 2020-07-31 04:07:34 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-08-07 03:54:59 +0000 |
commit | 207d9b74d130d4830f253c5a2f62d034d63fb002 (patch) | |
tree | 6485b6e4f78498514a3669d35c9dcd5f76644c18 /src | |
parent | 8563473e9cd60e3fc7dad0e57c8f314a3c3f74e0 (diff) | |
download | mongo-207d9b74d130d4830f253c5a2f62d034d63fb002.tar.gz |
SERVER-48305 Audit and remove unnecessary string copies in ephemeralForTest radix tree
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_radix_store.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_radix_store.h b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_radix_store.h index 2a20c94ee17..d7d388a7fd8 100644 --- a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_radix_store.h +++ b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_radix_store.h @@ -191,7 +191,7 @@ public: } // Get path from root to '_current' since it is required to traverse up the tree. - Key key = _current->_data->first; + const Key& key = _current->_data->first; std::vector<Node*> context = RadixStore::_buildContext(key, _root.get()); @@ -394,7 +394,7 @@ public: if (_current == nullptr) return; - Key key = _current->_data->first; + const Key& key = _current->_data->first; std::vector<Node*> context = RadixStore::_buildContext(key, _root.get()); Node* node = context.back(); @@ -547,7 +547,7 @@ public: } std::pair<const_iterator, bool> insert(value_type&& value) { - Key key = value.first; + const Key& key = std::move(value).first; Node* node = _findNode(key); if (node != nullptr || key.size() == 0) @@ -557,7 +557,7 @@ public: } std::pair<const_iterator, bool> update(value_type&& value) { - Key key = value.first; + const Key& key = std::move(value).first; // Ensure that the item to be updated exists. auto item = RadixStore::find(key); @@ -1646,7 +1646,7 @@ private: * equivalent to removing that data from the tree. */ std::pair<const_iterator, bool> _upsertWithCopyOnSharedNodes( - Key key, boost::optional<value_type> value) { + const Key& key, boost::optional<value_type> value) { const uint8_t* charKey = reinterpret_cast<const uint8_t*>(key.data()); @@ -1972,7 +1972,7 @@ private: * * This assumes that the key is present in the tree. */ - static std::vector<Node*> _buildContext(Key key, Node* node) { + static std::vector<Node*> _buildContext(const Key& key, Node* node) { std::vector<Node*> context; context.push_back(node); |