Skip to content

Commit

Permalink
fix: pre-allocate vec length
Browse files Browse the repository at this point in the history
  • Loading branch information
shuiyisong committed Mar 28, 2023
1 parent 47ab222 commit 130a2e4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/meta-srv/src/service/store/etcd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ impl KvStore for EtcdStore {
options,
} = req.try_into()?;

let mut prev_kvs = Vec::with_capacity(keys.len());

let delete_ops = keys
.into_iter()
.map(|k| TxnOp::delete(k, options.clone()))
Expand All @@ -189,8 +191,6 @@ impl KvStore for EtcdStore {
.await
.context(error::EtcdFailedSnafu)?;

let mut prev_kvs = vec![];

for op_res in txn_res.op_responses() {
match op_res {
TxnOpResponse::Delete(delete_res) => {
Expand Down

0 comments on commit 130a2e4

Please sign in to comment.