unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: Morgan Willcock <mwillcock@precedence.co.uk>
Cc: 50877@debbugs.gnu.org, Lars Ingebrigtsen <larsi@gnus.org>,
	Stefan Kangas <stefankangas@gmail.com>
Subject: bug#50877: 28.0.50; Gnus: nnimap backend is extremely slow to initialise new groups
Date: Tue, 28 Sep 2021 21:25:37 -0700	[thread overview]
Message-ID: <8735ponh32.fsf@ericabrahamsen.net> (raw)
In-Reply-To: <87pmssqsd2.fsf@precedence.co.uk> (Morgan Willcock's message of "Tue, 28 Sep 2021 22:53:45 +0100")

Morgan Willcock <mwillcock@precedence.co.uk> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> You could try reverting 20f7fa691b7c2859b96550d9ccb326bf394e160d and see
>> if that fixes it. That change went in in April, though, so unless you
>> haven't updated for a while (or you've been seeing this problem for a
>> long time) it might not be likely.
>
> Reverting that commit fixes it for me.

I'm cc'ing Lars and Stefan Kangas, who are the most "involved" here. The
benchmarks are gruesome:

(defun old-gnus-set-difference (list1 list2)
  "Return a list of elements of LIST1 that do not appear in LIST2."
  (let ((hash2 (make-hash-table :test 'eq))
        (result nil))
    (dolist (elt list2) (puthash elt t hash2))
    (dolist (elt list1)
      (unless (gethash elt hash2)
        (setq result (cons elt result))))
    (nreverse result)))

(let* ((common1 (number-sequence 0 200))
       (common2 (number-sequence 501 700))
       (l1 (append common1
		   (number-sequence 200 500 2)
		   common2))
       (l2 (append common1
		   (number-sequence 201 500 2)
		   common2))
       (results (list
		 (benchmark-run 1000 (old-gnus-set-difference l1 l2))
		 (benchmark-run 1000 (seq-difference l1 l2 #'eq)))))
  results)->
  ((1.842791826 7 1.4057783080000021)
   (14.284496493999999 4 0.7823414249999985))

This is a particularly bad example -- when there was no common2
`seq-difference' performed better, but I think it still around 6 seconds
to the old function's 2.

Probably still worth a dedicated function for Gnus? (Or a rewrite of
`seq-difference'...)

Eric





  reply	other threads:[~2021-09-29  4:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-28 21:27 bug#50877: 28.0.50; Gnus: nnimap backend is extremely slow to initialise new groups Morgan Willcock
2021-09-28 21:34 ` Eric Abrahamsen
2021-09-28 21:53   ` Morgan Willcock
2021-09-29  4:25     ` Eric Abrahamsen [this message]
2021-09-29  6:18       ` Lars Ingebrigtsen
2021-09-29  9:11         ` Stefan Kangas
2021-09-29 15:27           ` Lars Ingebrigtsen

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=8735ponh32.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=50877@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=mwillcock@precedence.co.uk \
    --cc=stefankangas@gmail.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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).