0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-07 20:48:55 +02:00

ircd|:Ⓜ️ Optimize path for head_idx()/depth() to avoid head id lookup.

This commit is contained in:
Jason Volk 2018-04-18 15:13:17 -07:00
parent fbc78c9c60
commit 328292ba0e

View file

@ -20,7 +20,20 @@ int64_t
ircd::m::depth(std::nothrow_t,
const id::room &room_id)
{
return std::get<int64_t>(top(std::nothrow, room_id));
const auto it
{
dbs::room_events.begin(room_id)
};
if(!it)
return -1;
const auto part
{
dbs::room_events_key(it->first)
};
return std::get<0>(part);
}
ircd::m::event::idx
@ -33,7 +46,20 @@ ircd::m::event::idx
ircd::m::head_idx(std::nothrow_t,
const id::room &room_id)
{
return std::get<event::idx>(top(std::nothrow, room_id));
const auto it
{
dbs::room_events.begin(room_id)
};
if(!it)
return 0;
const auto part
{
dbs::room_events_key(it->first)
};
return std::get<1>(part);
}
ircd::m::event::id::buf