]> git.eshelyaron.com Git - emacs.git/commit
CC Mode: Optimize scanning of heavily nested brace blocks
authorAlan Mackenzie <acm@muc.de>
Sun, 1 Dec 2024 17:27:34 +0000 (17:27 +0000)
committerEshel Yaron <me@eshelyaron.com>
Wed, 4 Dec 2024 17:02:13 +0000 (18:02 +0100)
commit30a8ec4c57b71a4679be6c0bd1572214d5fe7ca4
treef027a7ed40a1ff311b78d33bb1a7c0f5d86a8d96
parentda065b5571d2dd94065d33677563f4c07dffae3f
CC Mode: Optimize scanning of heavily nested brace blocks

This should have fixed bug#74357.

* lisp/progmodes/cc-engine.el (c-laomib-cache): Change the
size of this cache from 4 to 50.
(c-laomib-get-cache, c-laomib-put-cache): Use assq, memq, and
ntake or butlast, rather than looping through the cache with a
cdr loop.  No longer attempt to preserve the "largest" cache
element.
(c-looking-at-or-maybe-in-bracelist): Extend the range covered
by a c-laomib-cache element, rather than adding a second
element to the cache.
(c-no-bracelist-cache): A new cache for the use of
c-inside-bracelist-p, based on the c-parse-state cache.
(c-inside-bracelist-p): Use the new cache to call
c-looking-at-or-maybe-in-bracelist less often.

* lisp/progmodes/cc-mode.el (c-basic-common-init): Initialize
c-no-bracelist-cache.
(c-before-change): Invalidate c-no-bracelist-cache.

(cherry picked from commit b5f1a9e6d3e565585352747733c73d45e6be3bda)
lisp/progmodes/cc-engine.el
lisp/progmodes/cc-mode.el