Subject: bug#63842: 30.0.50; Slow 'gnus-summary-refer-thread'

From: Manuel Giraud <[email-masked]>
Date: Fri, 16 Jun 2023 12:36:48 +0200

Hi,

So here is the crux of this issue.  When using
'gnus-summary-refer-thread' in a nnml group, Emacs ends up calling
'gnus-get-newsgroup-headers-xover' (via 'gnus-fetch-headers').  AFAIU in
this function when 'gnus-read-all-available-headers' is t, Emacs will
parse *all* of the " *nntp*" buffer content.  In my case, this buffer is
quite big (about 50k lines and 23MiB) hence the slowness.

BTW, I also have examples where 'gnus-summary-refer-thread' gives me
some false positives (eg., not the same thread but part of the subject
matching)

I don't know how to proceed except from unsetting
'gnus-read-all-available-headers' for nnml backends (see attached
patch).
-- 
Manuel Giraud
>From 170cc2f96ebc606c25d85e345f9f9196fe6a7f33 Mon Sep 17 00:00:00 2001
From: Manuel Giraud <[email-masked]>
Date: Fri, 16 Jun 2023 12:20:32 +0200
Subject: [PATCH] Do not read all headers for nnml groups

---
 lisp/gnus/gnus-sum.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index 4effaa981ec..14da8735e88 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -9029,7 +9029,8 @@ gnus-summary-refer-thread
          (id (mail-header-id header))
          (gnus-inhibit-demon t)
          (gnus-summary-ignore-duplicates t)
-         (gnus-read-all-available-headers t)
+         (gnus-read-all-available-headers
+          (not (eq (car (gnus-find-method-for-group group)) 'nnml)))
          (gnus-refer-thread-use-search
           (if (or (null limit) (numberp limit))
               gnus-refer-thread-use-search
-- 
2.40.0