0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-01-16 01:26:58 +01:00

ircd:Ⓜ️:events: Reduce call count in for_each_sender loop.

This commit is contained in:
Jason Volk 2019-08-12 02:33:57 -07:00
parent ddfae956d2
commit ad571640e0

View file

@ -442,6 +442,7 @@ ircd::m::events::for_each_sender(const string_view &hostlb,
}; };
user::id::buf last; user::id::buf last;
string_view last_local, last_host;
for(auto it(column.lower_bound(hostlb)); bool(it); ++it) for(auto it(column.lower_bound(hostlb)); bool(it); ++it)
{ {
const string_view &host const string_view &host
@ -457,7 +458,7 @@ ircd::m::events::for_each_sender(const string_view &hostlb,
dbs::event_sender_key(it->first.substr(size(host))) dbs::event_sender_key(it->first.substr(size(host)))
}; };
if(last && host == last.host() && localpart == last.local()) if(last && host == last_host && localpart == last_local)
continue; continue;
last = m::user::id::buf last = m::user::id::buf
@ -467,6 +468,9 @@ ircd::m::events::for_each_sender(const string_view &hostlb,
if(!closure(last)) if(!closure(last))
return false; return false;
last_local = last.local();
last_host = last.host();
} }
return true; return true;