mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 08:12:37 +01:00
ircd:Ⓜ️:room::content: Add larger prefetch ring.
This commit is contained in:
parent
07733e6682
commit
85dd862760
1 changed files with 16 additions and 14 deletions
|
@ -8,35 +8,37 @@
|
||||||
// copyright notice and this permission notice is present in all copies. The
|
// copyright notice and this permission notice is present in all copies. The
|
||||||
// full license for this software is available in the LICENSE file.
|
// full license for this software is available in the LICENSE file.
|
||||||
|
|
||||||
decltype(ircd::m::room::content::prefetch_max)
|
|
||||||
ircd::m::room::content::prefetch_max
|
|
||||||
{
|
|
||||||
32
|
|
||||||
};
|
|
||||||
|
|
||||||
decltype(ircd::m::room::content::prefetch)
|
decltype(ircd::m::room::content::prefetch)
|
||||||
ircd::m::room::content::prefetch
|
ircd::m::room::content::prefetch
|
||||||
{
|
{
|
||||||
{ "name", "ircd.m.room.content.prefetch" },
|
{ "name", "ircd.m.room.content.prefetch" },
|
||||||
{ "default", 16L },
|
{ "default", 512L },
|
||||||
};
|
};
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ircd::m::room::content::for_each(const closure &closure)
|
ircd::m::room::content::for_each(const closure &closure)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
// ring queue buffer
|
|
||||||
using entry = pair<uint64_t, m::event::idx>;
|
using entry = pair<uint64_t, m::event::idx>;
|
||||||
entry queue[prefetch_max];
|
const size_t queue_max
|
||||||
|
{
|
||||||
|
size_t(content::prefetch)
|
||||||
|
};
|
||||||
|
|
||||||
|
// ring queue buffer
|
||||||
|
const std::unique_ptr<entry[]> buf
|
||||||
|
{
|
||||||
|
new entry[queue_max] {{0UL, 0UL}}
|
||||||
|
};
|
||||||
|
|
||||||
|
entry *const __restrict__ queue
|
||||||
|
{
|
||||||
|
buf.get()
|
||||||
|
};
|
||||||
|
|
||||||
// ring queue state
|
// ring queue state
|
||||||
size_t i{0}; // monotonic
|
size_t i{0}; // monotonic
|
||||||
size_t pos{0}; // modulated index of the current ring head.
|
size_t pos{0}; // modulated index of the current ring head.
|
||||||
const size_t queue_max
|
|
||||||
{
|
|
||||||
std::min(size_t(prefetch), size_t(prefetch_max))
|
|
||||||
};
|
|
||||||
|
|
||||||
bool ret{true};
|
bool ret{true};
|
||||||
const auto call_user
|
const auto call_user
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue