From d012bfbedf10b925433d1b7bd823370347371e33 Mon Sep 17 00:00:00 2001 From: "Eric Wong (Contractor, The Linux Foundation)" Date: Fri, 30 Mar 2018 01:20:48 +0000 Subject: feed: optimize query for feeds, too This is a smaller improvement than the landing /$INBOX/ page because full message bodies are shown; but still saves around 100ms for my system with LKML. --- lib/PublicInbox/View.pm | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'lib/PublicInbox/View.pm') diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index c151f221..8ac405f2 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -1063,25 +1063,10 @@ sub index_nav { # callback for WwwStream sub index_topics { my ($ctx) = @_; my ($off) = (($ctx->{qp}->{o} || '0') =~ /(\d+)/); - my $lim = 200; - my $opts = { offset => $off, limit => $lim }; $ctx->{order} = []; my $srch = $ctx->{srch}; - - my $qs = ''; - # this complicated bit cuts loading time by over 400ms on my system: - if ($off == 0) { - my ($min, $max) = $ctx->{-inbox}->mm->minmax; - my $n = $max - $lim; - $n = $min if $n < $min; - for (; $qs eq '' && $n >= $min; --$n) { - my $smsg = $srch->lookup_article($n) or next; - $qs = POSIX::strftime('d:%Y%m%d..', gmtime($smsg->ts)); - } - } - - my $sres = $srch->query($qs, $opts); + my $sres = $ctx->{-inbox}->recent({offset => $off, limit => 200 }); $sres = $sres->{msgs}; my $nr = scalar @$sres; if ($nr) { -- cgit v1.2.3-24-ge0c7