]> git.eshelyaron.com Git - emacs.git/commit
Flymake: speed up mode-line display with simple cache
authorJoão Távora <joaotavora@gmail.com>
Tue, 5 Sep 2023 16:20:25 +0000 (17:20 +0100)
committerJoão Távora <joaotavora@gmail.com>
Tue, 5 Sep 2023 17:27:42 +0000 (18:27 +0100)
commit07454c47a62d9450f194dc0177a3a5b10846195b
tree1d5dd384dbb121ee24073366b65d6c6c26cbd7bc
parent2e7af2fc5304b9dfda944ced67b366e4576a1035
Flymake: speed up mode-line display with simple cache

When scrolling heavily (perhaps holding down C-n), the function
'flymake-mode-line-counter' showed very prominently in the memory and
CPU profiles.

Using a cache here was trivial, if not particularly pretty.  The
function all but disappears from the profiles afterwards.

* lisp/progmodes/flymake.el (flymake--mode-line-counter-cache):
New variable.
(flymake--publish-diagnostics): Flush cache aggressively.
(flymake-mode-line-error-counter): Adjust.
(flymake--mode-line-counter-1): New helper from earlier
flymake--mode-line-counter.
(flymake--mode-line-counter): Use cache.
lisp/progmodes/flymake.el