Avoid unnecessary copy of sample_slice map (#9551)

Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/9551

Reviewed By: riversand963

Differential Revision: D34169574

Pulled By: ezgicicek

fbshipit-source-id: 2e88db59b65bda269917a9b0bed17181a4afd281
This commit is contained in:
Ezgi Çiçek 2022-02-11 09:14:30 -08:00 committed by Facebook GitHub Bot
parent a1203edca4
commit 95d9cb8357
1 changed files with 1 additions and 2 deletions

View File

@ -784,8 +784,7 @@ size_t DBImpl::EstimateInMemoryStatsHistorySize() const {
size_t size_per_slice =
sizeof(uint64_t) + sizeof(std::map<std::string, uint64_t>);
// non-empty map, stats_history_.begin() guaranteed to exist
std::map<std::string, uint64_t> sample_slice(stats_history_.begin()->second);
for (const auto& pairs : sample_slice) {
for (const auto& pairs : stats_history_.begin()->second) {
size_per_slice +=
pairs.first.capacity() + sizeof(pairs.first) + sizeof(pairs.second);
}