From 7642f50ebbbf1baa475dc4342aba2fdb34930e55 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sun, 6 Sep 2020 02:58:49 -0700 Subject: [PATCH] ircd::m::events: Add readahead; add conf item. --- matrix/events.cc | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/matrix/events.cc b/matrix/events.cc index def47cbb6..75029fd49 100644 --- a/matrix/events.cc +++ b/matrix/events.cc @@ -347,6 +347,18 @@ ircd::m::events::for_each(const range &range, // events::state // +namespace ircd::m::events::content +{ + extern conf::item readahead; +} + +decltype(ircd::m::events::content::readahead) +ircd::m::events::content::readahead +{ + { "name", "ircd.m.events.content.readahead" }, + { "default", long(4_MiB) }, +}; + bool ircd::m::events::content::for_each(const closure &closure) { @@ -360,13 +372,15 @@ ircd::m::events::content::for_each(const closure &closure) dbs::event_column.at(content_idx) }; - static const db::gopts gopts + db::gopts gopts { db::get::NO_CACHE, db::get::NO_CHECKSUM }; - for(auto it(column.begin(gopts)); bool(it); ++it) + gopts.readahead = size_t(readahead); + auto it(column.begin(gopts)); + for(; it; ++it) { const auto &event_idx {