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
main
Ezgi Çiçek 3 years ago committed by Facebook GitHub Bot
parent a1203edca4
commit 95d9cb8357
  1. 3
      db/db_impl/db_impl.cc

@ -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);
}

Loading…
Cancel
Save