Avoid an std::map copy in persistent stats (#11681)

Summary:
An internal user reported this copy showing up in a CPU profile. We can use move instead.

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

Differential Revision: D48103170

Pulled By: ajkr

fbshipit-source-id: 083d6470181a0041bb5275b657aa61bee23a3729
This commit is contained in:
Andrew Kryczka 2023-08-06 18:01:08 -07:00 committed by Facebook GitHub Bot
parent eca48bc166
commit 4500a0d6ec
1 changed files with 1 additions and 1 deletions

View File

@ -970,7 +970,7 @@ void DBImpl::PersistStats() {
"Storing %" ROCKSDB_PRIszt " stats with timestamp %" PRIu64
" to in-memory stats history",
stats_slice_.size(), now_seconds);
stats_history_[now_seconds] = stats_delta;
stats_history_[now_seconds] = std::move(stats_delta);
}
stats_slice_initialized_ = true;
std::swap(stats_slice_, stats_map);