From 0843d441ffa5c9c24f4c2d3eb14ab5b752d6ef6a Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Sun, 1 Aug 2021 16:57:59 +0300 Subject: [PATCH] db: schema_tables: unpeel lw_shared_ptr in create_Tables_from_tables_partition() The tables local is a lw_shared_ptr which is created and then refeferenced before returning. It can be unpeeled to the pointed-to type, resulting in one less allocation. --- db/schema_tables.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/db/schema_tables.cc b/db/schema_tables.cc index dc9fc8a82f..b76a7ded6f 100644 --- a/db/schema_tables.cc +++ b/db/schema_tables.cc @@ -2347,15 +2347,15 @@ future create_table_from_name(distributed& p */ future> create_tables_from_tables_partition(distributed& proxy, const schema_result::mapped_type& result) { - auto tables = make_lw_shared>(); + auto tables = std::map(); co_await parallel_for_each(result->rows().begin(), result->rows().end(), [&] (const query::result_set_row& row) -> future<> { schema_ptr cfm = co_await create_table_from_table_row(proxy, row); { - tables->emplace(cfm->cf_name(), std::move(cfm)); + tables.emplace(cfm->cf_name(), std::move(cfm)); } }); { - co_return std::move(*tables); + co_return std::move(tables); } }