From 0f15da1c2db1d5583d0c7200208b6465357f95fc Mon Sep 17 00:00:00 2001 From: generatedunixname1395027625275998 Date: Mon, 6 Jul 2026 19:48:44 -0700 Subject: [PATCH] Reserve key_context capacity in MultiGetCommon to avoid autovector reallocs (#14909) Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/14909 Reviewed By: kunalspathak Differential Revision: D110380492 fbshipit-source-id: d1d3214c52a65326de237adcbfe6ea5d23d94960 --- db/db_impl/db_impl.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/db/db_impl/db_impl.cc b/db/db_impl/db_impl.cc index b20d9730af..45f98831a4 100644 --- a/db/db_impl/db_impl.cc +++ b/db/db_impl/db_impl.cc @@ -3761,6 +3761,7 @@ void DBImpl::MultiGetCommon(const ReadOptions& read_options, } autovector key_context; + key_context.reserve(num_keys); autovector sorted_keys; sorted_keys.resize(num_keys); for (size_t i = 0; i < num_keys; ++i) { @@ -3951,6 +3952,7 @@ void DBImpl::MultiGetCommon(const ReadOptions& read_options, } } autovector key_context; + key_context.reserve(num_keys); autovector sorted_keys; sorted_keys.resize(num_keys); for (size_t i = 0; i < num_keys; ++i) {