From 5a69dffc4155c8810dd8f2f3474f7a8a5c6d16a2 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 20 Aug 2020 20:24:50 +0000 Subject: searchview: speed up search summary by ~10% Instead of loading one article at-a-time from over.sqlite3, we can use SQL to mass-load IN (?,?, ...) all results with a single SQLite query. Despite SQLite being in-process and having no network latency, the reduction in SQL query executions from loading multiple rows at once speeds things up significantly. We'll keep the over->get_art optimizations from the previous commit, since it still speeds up long-lived responses, slightly. --- lib/PublicInbox/Over.pm | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/PublicInbox/Over.pm') diff --git a/lib/PublicInbox/Over.pm b/lib/PublicInbox/Over.pm index 80e57e62..a055b4cd 100644 --- a/lib/PublicInbox/Over.pm +++ b/lib/PublicInbox/Over.pm @@ -104,6 +104,15 @@ ORDER BY num ASC } +sub get_all { + my $self = shift; + my $nr = scalar(@_) or return []; + my $in = '?' . (',?' x ($nr - 1)); + do_get($self, <<"", { cull => 1, limit => $nr }, @_); +SELECT num,ds,ddd FROM over WHERE num IN ($in) + +} + sub nothing () { wantarray ? (0, []) : [] }; sub get_thread { -- cgit v1.2.3-24-ge0c7