mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-05 06:23:03 +00:00
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.
This commit is contained in:
@@ -2347,15 +2347,15 @@ future<schema_ptr> create_table_from_name(distributed<service::storage_proxy>& p
|
||||
*/
|
||||
future<std::map<sstring, schema_ptr>> create_tables_from_tables_partition(distributed<service::storage_proxy>& proxy, const schema_result::mapped_type& result)
|
||||
{
|
||||
auto tables = make_lw_shared<std::map<sstring, schema_ptr>>();
|
||||
auto tables = std::map<sstring, schema_ptr>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user