]> git.eshelyaron.com Git - emacs.git/commit
Improve performance let-binding `case-fold-search' (bug#66117)
authorIhor Radchenko <yantar92@posteo.net>
Fri, 15 Dec 2023 10:47:45 +0000 (11:47 +0100)
committerEshel Yaron <me@eshelyaron.com>
Tue, 2 Jan 2024 07:52:03 +0000 (08:52 +0100)
commit58886ded70bd1610788cfcc58be8681dc279d633
treed9abbbe6b24ef2e4d88f8b4c33c42c0f14ba5546
parentd8cc8c77a957590c73b2554420ccbc90ee3c445a
Improve performance let-binding `case-fold-search' (bug#66117)

* src/buffer.h: Remove case_fold_search_ buffer object slot.
* src/buffer.c (bset_case_fold_search): Remove - no longer needed.
(init_buffer_once): Remove removed buffer slot init.
(syms_of_buffer): Use DEFVAR_LISP to define `case-fold-search' and
declare it buffer-local.
* src/minibuf.c (syms_of_minibuf): Remove DEFSYM call for
`case-fold-search' symbol.  It now lives in `syms_of_buffer'.
* src/editfns.c (Fcompare_buffer_substrings):
(Fchar_equal):
* src/search.c (looking_at_1):
(string_match_1):
(search_command):
(Fre__describe_compiled): Adjust C queries to `case-fold-search' value
to use C globals instead of BVAR macro.
* doc/lispref/internals.texi (Buffer Internals): Do not list
`case_fold_search' slot.

See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=66117#259

When used as buffer slot, let-binding `case-fold-search' would scale
with the number of live buffers and can be slow.  This change makes
let-binding much faster at the cost of slightly slower `set-buffer'.

(cherry picked from commit aa0037aaf7c2cd7052925fdeca73c77c91254de1)
doc/lispref/internals.texi
src/buffer.c
src/buffer.h
src/editfns.c
src/minibuf.c
src/search.c