From 347cdba1c6a4e10b063cc6c591d81ea07270e5c7 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 17 Sep 2020 01:43:06 -0700 Subject: [PATCH] ircd::m::room::auth: Parallelize index query. --- matrix/room_auth.cc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/matrix/room_auth.cc b/matrix/room_auth.cc index be699d3ac..35e2e827c 100644 --- a/matrix/room_auth.cc +++ b/matrix/room_auth.cc @@ -574,14 +574,19 @@ ircd::m::room::auth::static_idx(const event &event) count, }; - return + size_t i(0); + m::event::id ids[5]; + std::array idxs {{0}}; + for(; i < count && i < 5; ++i) + ids[i] = refs.auth_event(i); + + assert(i <= idxs.size()); + const auto found { - count > 0? m::index(refs.auth_event(0)): 0UL, - count > 1? m::index(refs.auth_event(1)): 0UL, - count > 2? m::index(refs.auth_event(2)): 0UL, - count > 3? m::index(refs.auth_event(3)): 0UL, - count > 4? m::index(refs.auth_event(4)): 0UL, + m::index(idxs, vector_view(ids, i)) }; + + return idxs; } std::array