all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Should `get-file-buffer' be implemented in Elisp?
Date: Sun, 16 Jul 2023 20:19:10 +0000	[thread overview]
Message-ID: <87h6q31uf5.fsf@localhost> (raw)
In-Reply-To: <83cz0r8ygk.fsf@gnu.org>

Eli Zaretskii <eliz@gnu.org> writes:

>> I stay corrected.
>
> No need to stand corrected: the key is the interpretation of "as many
> as possible" -- it is not as simplistic as perhaps it could be.
>
> Basically, we have enough good reasons to rock the boat and make
> changes which could as side effects introduce bugs and subtle behavior
> change; let's not risk that when we don't have such a good reason.

Ok.

My original motivation about `get-file-buffer' was an observation that
searching alist might be sub-optimal.
I now have (length (buffer-list)) ;=> 578
and I though that it might be a good idea to keep track of
buffer name -> buffer associations in a hash table.
In particular, when using `get-buffer-create', and the buffer name does
not exist, Emacs has to scan all the buffer list, fail, and go ahead
creating the buffer. Hash table would help significantly in such
scenarios. And in general lookup as well as hash tables start to
outperform alists just at 20-30 elements [1]

But hacking C code and adding yet another internal variable looked like
not justified.

[1] https://flandrew.srht.site/listful/embracing-emacs-lisp-hash-tables-introducing-xht.html

-- 
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>



  reply	other threads:[~2023-07-16 20:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-16 18:40 Should `get-file-buffer' be implemented in Elisp? Ihor Radchenko
2023-07-16 18:51 ` Eli Zaretskii
2023-07-16 19:05   ` Ihor Radchenko
2023-07-16 19:10     ` Eli Zaretskii
2023-07-16 20:19       ` Ihor Radchenko [this message]
2023-07-16 23:28         ` Po Lu
2023-07-17  5:06         ` tomas
2023-07-17  9:28           ` Ihor Radchenko
2023-07-17 13:11             ` Eli Zaretskii
2023-07-17 17:48             ` tomas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h6q31uf5.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.