From 95d9cb8357d8950b89d3d7bc98cb7a0bd03a1247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ezgi=20=C3=87i=C3=A7ek?= Date: Fri, 11 Feb 2022 09:14:30 -0800 Subject: [PATCH] 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 --- db/db_impl/db_impl.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/db/db_impl/db_impl.cc b/db/db_impl/db_impl.cc index ec0275cc3..03fa01da5 100644 --- a/db/db_impl/db_impl.cc +++ b/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); // non-empty map, stats_history_.begin() guaranteed to exist - std::map 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); }