mirror of
https://github.com/matrix-construct/construct
synced 2024-09-27 11:18:51 +02:00
ircd:Ⓜ️:room: Optimize the state::count(void) to elide key parse, value query.
This commit is contained in:
parent
9bff6a5b0d
commit
89e3838c4f
1 changed files with 14 additions and 1 deletions
|
@ -2129,7 +2129,20 @@ size_t
|
||||||
ircd::m::room::state::count()
|
ircd::m::room::state::count()
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
return count(string_view{});
|
if(!present())
|
||||||
|
return count(string_view{});
|
||||||
|
|
||||||
|
const db::gopts &opts
|
||||||
|
{
|
||||||
|
this->fopts? this->fopts->gopts : db::gopts{}
|
||||||
|
};
|
||||||
|
|
||||||
|
size_t ret(0);
|
||||||
|
auto &column{dbs::room_state};
|
||||||
|
for(auto it{column.begin(room_id, opts)}; bool(it); ++it)
|
||||||
|
++ret;
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
|
|
Loading…
Reference in a new issue