Subject: Re: bug#31853: 27.0.50; binding case-fold-search is slow when there are many buffers

From: Eli Zaretskii <[email-masked]>
Date: Sat, 16 Jun 2018 09:45:20 +0300

> From: Aaron Jensen <[email-masked]>
> Date: Fri, 15 Jun 2018 18:42:09 -0700
> 
> This is related to or maybe is bug#18522, which supposedly was fixed,

It is related to that bug only if you have a lot of dead buffers.  The
URL pointed out by Noam includes a patch that would allow you to count
dead buffers you have; can you do that?

> but it is unclear from the thread if just the usage of case-fold-search was
> fixed or if the slow binding was meant to have been fixed.

None of the above, AFAIU.  Gnus was fixed to not hit this problem.

> (benchmark 1 '(let ((case-fold-search t)) t))
> 
> is roughly 1ms on a longer running emacs and .02ms on a fresh emacs.
> 
> My (length (buffer-list)) is 91 on the longer running emacs and 23 on
> the fresh.

In a session that has 291 buffers, I get 2.8 microseconds, whereas in
fresh "emacs -Q", I get 1.5 microseconds.  This is 3 orders of
magnitude faster than what you get, and the difference between a large
session and a new one is much smaller.

IOW, there's some factor here that is not just the number of buffers
you have, I think.