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 #29 received at 66117 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: dmitry <at> gutov.dev, 66117 <at> debbugs.gnu.org
Subject: Re: bug#66117: 30.0.50; `find-buffer-visiting' is slow when opening
 large number of buffers
Date: Fri, 22 Sep 2023 13:30:41 +0000
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Will it be acceptable to implement the cache using variable watchers?
>
> I don't like us using variable watchers for such stuff.
>
> Why cannot we just cache the correspondence between files and buffers
> in some hash-table?

Because `buffer-file-name' can be modified from Lisp (via
`set-visited-file-name' or directly). Same for `buffer-file-truename'
and `buffer-file-number'.

Or should we just assume that these variables remain unchanged other
than by primitives?

>> The regression might happen when the number of buffers is small -
>> when hash tables become slower compared to simple list lookup.
>> But in such scenario, we will be talking about very small absolute
>> runtimes anyway, so it should probably not matter in practice.
>
> Alternatively, only create the hash-table when the number of buffers
> exceeds some threshold.

Indeed, this is a good idea.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




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

Previous Next


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