Reserve space for result in BinlogKeyValue::get_all().

This commit is contained in:
levlam 2023-10-12 21:04:09 +03:00
parent 7644caaf60
commit a6fbed2ad7
1 changed files with 1 additions and 0 deletions

View File

@ -232,6 +232,7 @@ class BinlogKeyValue final : public KeyValueSyncInterface {
FlatHashMap<string, string> get_all() final {
auto lock = rw_mutex_.lock_write().move_as_ok();
FlatHashMap<string, string> res;
res.reserve(map_.size());
for (const auto &kv : map_) {
res.emplace(kv.first, kv.second.first);
}