Subject: Re: bug#72551: 28.2; slowness in global minor mode

From: Eli Zaretskii <[email-masked]>
Date: Sat, 10 Aug 2024 08:53:51 +0300

> Date: Fri, 09 Aug 2024 18:57:54 +0000
> From:  "Michael Grant" via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <[email-masked]>
> 
> To reproduce:
> 
> emacs -Q --eval '
> (progn (require (quote cl))
>    (load "~/.emacs.d/elpa/yascroll-20220212.1742/yascroll-autoloads.el")
>    (cl-loop repeat 100 collect (generate-new-buffer "Test"))
>    (global-yascroll-bar-mode 1)
>    (setq yascroll:delay-to-hide nil)
>    (cl-loop for i below 200 do (insert (format "line %d\n" i)))
>    (goto-char (point-min))
>    (insert "\n\n --> Now type C-x C-b and see how long it takes! 
> <--\n\n"))'
> 
> note, you need to have the yascroll package installed.  Your package
> directory may vary.  This does not seem specific to yascroll, it's just 
> easily
> reproduced with yascroll.
> 
> The expected result is that it shows the buffer list nearly instantly.
> The actual result is it takes several seconds!
> 
> It seems like something is looping over each buffer and calling
> something on each buffer to see if yascroll needs to be enabled.
> 
> If a bugfix is not forthcoming, a workaround would be appreciated!

Yascroll is not part of Emacs, and there are several issues about
slowdown on its GitHub site.  My suggestion is to take this up with
yascroll's developers.

The first step towards finding the culprit and potential workarounds
is to profile the slow operation with the Emacs Lisp profiler.