bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#18522: 24.4.50; mapcar is very slow


From: Eli Zaretskii
Subject: bug#18522: 24.4.50; mapcar is very slow
Date: Thu, 25 Feb 2016 17:59:41 +0200

> From: Peter Münster <pmlists@free.fr>
> Cc: Eli Zaretskii <eliz@gnu.org>,  18522@debbugs.gnu.org
> Date: Thu, 25 Feb 2016 09:08:44 +0100
> 
> > Just on a hunch -- what's the value of your `gnus-buffers' variable?
> 
> (#<buffer *unsent mail*> #<buffer *sent mail to Eli Zaretskii*<2>> #<buffer 
> *sent mail to Eli Zaretskii*> #<buffer *Article nndraft:drafts*> #<buffer  
> *Original Article nndraft:drafts*> #<buffer *Summary nndraft:drafts*> 
> #<killed 
> buffer> #<buffer  *nnmail message-id cache*> #<killed buffer> #<killed 
> buffer> 
> #<killed buffer> #<killed buffer> #<killed buffer> #<killed buffer> #<killed 
> buffer> #<killed buffer> #<killed buffer> #<killed buffer> #<killed buffer> 
> #<killed buffer> #<killed buffer> #<killed buffer> #<killed buffer> #<killed 
> buffer> #<killed buffer> #<killed buffer> #<killed buffer> #<killed buffer> 
> #<killed buffer> #<killed buffer> #<buffer  *MML2015 Result*> #<killed 
> buffer> 
> #<buffer  *gnus article copy*> #<buffer  *Gnus Backlog*> #<buffer  *gnus 
> work*> 
> #<buffer  *Gnus agent overview*> #<buffer *Group*>)

OK, so is the following summary of this long discussion accurate?

 . Peter noticed that Gnus is very slow entering a group
 . Gnus is slow because parse-time-string takes a lot of time
 . parse-time-string is slow because it let-binds case-fold-search
 . binding case-fold-search is slow because Peter has a lot of
   buffers, which set-default loops over to change the value of
   case-fold-search in each one of them
 . most of the buffers over which set-default loops were actually
   killed, but they are still in all_buffers list which set-default
   traverses, although they were supposed to be removed by GC
 . killed buffers are not removed from all_buffers by GC because
   they are referenced by gnus-buffers
 . gnus-buffers references killed buffers because Peter kills buffers
   behind Gnus back, instead of letting them be killed through
   gnus-kill-buffer, which would have removed them from gnus-buffers

If the above is an accurate account of what we've discovered, then we
have several factors here that conspire to make Peter's Gnus slow:

 . parse-time-string should try to avoid binding case-fold-search
   globally, or at all
 . set-default should skip killed buffers
 . Peter should stop killing Gnus buffers behind Gnus back

For the first issue, I propose to modify parse-time-string to use
upcase and downcase instead of string-match.  E.g., this:

  (/= (downcase char) char)

can be used to detect upper-case characters, and similarly with
lower-case.

For the second issue, I propose to modify set-default to use
FOR_EACH_LIVE_BUFFER instead of FOR_EACH_BUFFER.  Does anyone see a
problem with that?

For the third issue, Peter should make his buffer-killing code look in
gnus-buffers, and kill any buffers referenced by it through
gnus-kill-buffer.  If this involves some standard Emacs features (like
'midnight', perhaps), then those features should also be adapted to
gnus-buffers.

Comments?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]