GNU bug report logs - #66117
30.0.50; `find-buffer-visiting' is slow when opening large number of buffers

Previous Next

Package: emacs;

Reported by: Ihor Radchenko <yantar92 <at> posteo.net>

Date: Wed, 20 Sep 2023 08:53:02 UTC

Severity: minor

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #65 received at 66117 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: dmitry <at> gutov.dev, Eli Zaretskii <eliz <at> gnu.org>, 66117 <at> debbugs.gnu.org
Subject: Re: bug#66117: 30.0.50; `find-buffer-visiting' is slow when opening
 large number of buffers
Date: Thu, 28 Sep 2023 01:30:37 +0200
Ihor Radchenko <yantar92 <at> posteo.net> writes:

> So, using `with-current-buffer' when looping over all the buffers is
> certainly not optimal (maybe in other places as well).
>
> However, even `buffer-local-value' is still costly - it adds up over 50%
> run time.

OTOH - I tried to reproduce your experiments here locally -
`find-buffer-visiting' only takes 12% of the total run time here when
using the `buffer-local-value' tuned definition of `find-buffer-visiting'.

When we additionally merge the two loops in `find-buffer-visiting' into
one loop and avoid the duplicated calls of `buffer-local-value', don't we
reach a region where maintaining a separate cache doesn't make sense for
the additional gain?

And I wonder which part(s) of `buffer-local-value' is/are that costly,
and why.

Storing the same information twice - once in a buffer local variable,
and then again in a cache that needs to be updated separately doesn't
sound very reasonable.


Michael.




This bug report was last modified 1 year and 136 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.