Gnus development mailing list
 help / color / mirror / Atom feed
From: dreschs@mpd.tandem.com (Sten Drescher)
Subject: Re: Group sorting
Date: 12 Dec 1995 16:33:09 -0600	[thread overview]
Message-ID: <55ivjlud3u.fsf@galil.austnsc.tandem.com> (raw)
In-Reply-To: larsi@ifi.uio.no's message of 12 Dec 1995 21:59:56 +0100

larsi@ifi.uio.no (Lars Magne Ingebrigtsen) said:

LMI> dreschs@mpd.tandem.com (Sten Drescher) writes:
>> (setq gnus-group-sort-function '(gnus-group-sort-by-level
>> gnus-group-sort-by-unread))
>> 
>> This would first do a complete sorting by level, then a complete
>> sorting by unread - 2 complete sorts.  I'd want it to work in a
>> single sort - the sort would compare the unread keys, and _only_ if
>> they matched, compare the level keys.

LMI> Ok, that would be workable.  Gnus could transmogrify that list to

LMI> (lambda (g1 g2)
LMI>   (or (gnus-group-sort-by-unread g1 g2)
LMI>       (and (not (gnus-group-sort-by-unread g2 g1))
LMI> 	   (gnus-group-sort-by-level g1 g2))))

LMI> and give that as the predicate to sort.  Won't this give you the
LMI> same results as first using `gnus-group-sort-by-level' as a
LMI> predicate and then `gnus-group-sort-by-unread' as a predicate for
LMI> sort?

LMI> I have no idea whether it will be faster, though...

	I don't know, because I don't understand the elisp - what is it
doing?  Is it still sorting the entire list of groups between g1 and g2,
or does that fragment just compare two groups?  If each
gnus-group-sort-by-x sorts a list of groups, then no, it appears that it
will be worse, as you are doing three sorts instead of two!

	As it is now, two entire sorts are done with one key each -
every group is sorted by level, then every group is sorted by
unread. I'm proposing that one sort be done with two keys - every group
is sorted by unread, then ONLY IF the unread counts are equal are the
two groups being compared sorted by level.  This is a _significant_
difference in sort time, as only a small percentage of groups will have
identical unread counts.  This difference might be noticable with a
small number of groups, but even with only about 2500 groups I can tell
the difference between one and two sorts, and I'm dreading seeing even a
single sort with the 14,000 groups my ISP carries.  Remember, the time
for a bubble sort grows as the square of the number of sorted items.
However,

LMI> (`gnus-group-sort-by-level' should really be called
LMI> `gnus-group-level-less' or something since it is a `less' function
LMI> and not an actual sorting function...)

LMI> -- Home is where the cat is.



-- 
#include <disclaimer.h>				/* Sten Drescher */
To get my PGP public key, send me email with your public key and
	Subject: PGP key exchange
Key fingerprint =  90 5F 1D FD A6 7C 84 5E  A9 D3 90 16 B2 44 C4 F3


  reply	other threads:[~1995-12-12 22:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-12-05 17:31 Sten Drescher
1995-12-06  5:05 ` Lars Magne Ingebrigtsen
1995-12-08 17:32   ` Sten Drescher
1995-12-10 15:16     ` Lars Magne Ingebrigtsen
1995-12-11 16:37       ` Sten Drescher
1995-12-12 20:59         ` Lars Magne Ingebrigtsen
1995-12-12 22:33           ` Sten Drescher [this message]
1995-12-13 17:30             ` Lars Magne Ingebrigtsen
1995-12-14 15:56               ` Hallvard B Furuseth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55ivjlud3u.fsf@galil.austnsc.tandem.com \
    --to=dreschs@mpd.tandem.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).