Reserve space for result in BinlogKeyValue::get_all().
This commit is contained in:
parent
7644caaf60
commit
a6fbed2ad7
@ -232,6 +232,7 @@ class BinlogKeyValue final : public KeyValueSyncInterface {
|
|||||||
FlatHashMap<string, string> get_all() final {
|
FlatHashMap<string, string> get_all() final {
|
||||||
auto lock = rw_mutex_.lock_write().move_as_ok();
|
auto lock = rw_mutex_.lock_write().move_as_ok();
|
||||||
FlatHashMap<string, string> res;
|
FlatHashMap<string, string> res;
|
||||||
|
res.reserve(map_.size());
|
||||||
for (const auto &kv : map_) {
|
for (const auto &kv : map_) {
|
||||||
res.emplace(kv.first, kv.second.first);
|
res.emplace(kv.first, kv.second.first);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user