Gnus development mailing list
 help / color / mirror / Atom feed
* nnvirtual
@ 2017-05-03 12:31 Andrew Cohen
  2017-05-03 18:00 ` nnvirtual Eric Abrahamsen
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Andrew Cohen @ 2017-05-03 12:31 UTC (permalink / raw)
  To: ding


Gnus has had the nnvirtual backend, allowing several newsgroups to be
read as a single, combined newsgroup, for ages. But is anyone using it?
And if so, how and why?

Background (if you are interested): the new backend I have written,
nnselect, is a general backend that can take any set of articles and
treat them like a single group. This group behaves in all respects like
any regular gnus group (subject to bugs, and a few untested items like
article caching and the agent). One use (but not the only use) is to use
a search function to obtain the selection of articles.

So nnselect can be used as a full replacement for nnvirtual, in addition
to doing lots more. For reference, the function that you can find at the
end of this message can be used to combine groups (it takes a list of
groups to combine as argument).

So why my question? In part, because the way I am doing things has some
performance issues when you have a group with hundreds of thousands of
articles (which is often the case for gmane, since nothing ever
expires). I can fix all of the performance issues with one exception:
retrieving a hundred thousand headers and doing anything with them is
never going to be speedy. And this has nothing to do with combining but
just getting and dealing with all these headers is trouble. So to
optimize things well I want to know what people are really doing with
these combined groups. In a past life, when gmane searching was
available, I had a straightforward answer to this question: I just
searched for whatever articles were of interest and made my group out of
these. I never needed to combine whole groups.

But search is now defunct (at least for the moment). And I must say,
using gmane without it kind of sucks. So I rarely do anything more
complicated than looking at recent messages, and occasionally going back
to look through the past several hundred messages. Never more
than 500. Or maybe 1000.

So the really simple thing that I have done in the function that follows
is apply a (configurable) limit to how many articles are in the combined
group from any one component group. I have been using this for a week
now with the limit set at 1000 which has a noticeable but not annoying
impact on performance. But I've also set the limit to 100,000 and tried
to pull in gmane.emacs.gnus.general (which stands at around 85,000
messages). I never successfully retrieved a header list (either with
nnselect or with nntp) but the nnselect part of the code did fine,
albeit with a few seconds devoted to some avoidable bookkeeping. But I
don't want to spend time writing code to avoid the bookkeeping if it
isn't something that is relevant anyway.

Here is the promised function to use with nnselect (set limit to
whatever number you like. 500 probably has no detectable effect on
performance and should pull in all the articles you are likely to be
interested in. Then when creating the group use select-to-virtual as the
nnselect-function and a list of the groups you want to combine as the
nnselect-args. Note that you can combine any groups from any combination
of servers/backends. And the limit applies per group, not to the
aggregate.):

  (defun select-to-virtual (groups)
    (let ((limit 1000))
      (apply #'vconcat
	     (mapcar
	      #'(lambda (group)
		  (pcase-let ((`(,min . ,max) (gnus-active group))
			      (value))
		    (when (> (- max min) limit) (setq min (- max limit)))
		    (dotimes (number (1+ (- max min)) value)
		      (push  (vector group (+ min number) 1)
			     value))
		    (nreverse value)))
	      groups))))




^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2018-04-11 19:42 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-03 12:31 nnvirtual Andrew Cohen
2017-05-03 18:00 ` nnvirtual Eric Abrahamsen
2017-05-04  1:06   ` nnvirtual Andrew Cohen
2017-05-05  4:30     ` nnvirtual Eric Abrahamsen
2017-05-05 12:09       ` nnvirtual Andrew Cohen
2017-05-05 12:51         ` nnvirtual Andrew Cohen
2017-05-05 15:46         ` nnvirtual Eric Abrahamsen
2017-05-06  0:20           ` nnvirtual Andrew Cohen
2017-05-07  2:39             ` nnvirtual Eric Abrahamsen
2017-05-12 15:38 ` nnvirtual Steinar Bang
2017-05-12 17:42   ` nnvirtual Adam Sjøgren
2017-05-13  0:17     ` nnvirtual Harry Putnam
2018-04-11 19:42 ` nnvirtual Lars Ingebrigtsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).