1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-23 21:13:52 -08:00
emacs/etc
João Távora 236647ab58 Eglot: spectacular optimization in files with many diagnostics
In a large (or simply long) file with many diagnostics, calling
eglot-range-region repeteadly constantly throws Emacs for a spin
around the buffer, since each diagnostics comes annotated with a
(line/col): LSP range spec that is reasonably expensive to
translate into Elisp point positions.

A much faster approach for such large lists is to first sort all the
objects containing ranges by their start lines and then do a
single pass of the buffer, moving lines by delta.

By much faster, I do mean spectacularly (100x) faster. A long python
with 7000 "ruff" diagnostics, before the change, typical editor
operations (add/delete words) are impossible.

       14053  84%    - jsonrpc-connection-receive
       14052  84%     - #<byte-code-function B94>
       14052  84%      - apply
       14052  84%       - eglot-handle-notification
       14052  84%        - applyn
       14052  84%         - #<byte-code-function 6DB>
       14052  84%          - eglot--flymake-handle-push
       12295  74%           - eglot--flymake-make-diag
       12218  73%            + eglot-range-region
          50   0%            + eglot--check-object
          12   0%              plist-member
           3   0%              flymake-make-diagnostic

After the change:

          99   1%    - jsonrpc-connection-receive
          99   1%     - #<byte-code-function 0EE>
          99   1%      - apply
          99   1%       - eglot-handle-notification
          99   1%        - apply
          99   1%         - #<byte-code-function E84>
          99   1%          - eglot--flymake-handle-push
          99   1%           - eglot--call-with-ranged
          99   1%            - #<byte-code-function 2C6>
          99   1%             - eglot-move-to-utf-16-linepos
          99   1%                line-end-position

* lisp/progmodes/eglot.el (eglot-move-to-linepos-function):
Forward declare.
(eglot--call-with-ranged, eglot--collecting-ranged): New helpers.
(eglot--flymake-report-1)
(eglot--imenu-SymbolInformation): Use eglot--collecting-ranged.
(eglot--imenu-DocumentSymbol): Could use eglot--collecting-ranged.

* etc/EGLOT-NEWS: Mention it
2026-01-11 03:42:01 +00:00
..
charsets ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
e Add auto-margin enable/disable to term 2025-03-02 16:01:13 -05:00
forms ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
gnus
images ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
nxml
org ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
refcards ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
schema ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
srecode ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
themes ; * etc/themes/modus-themes.el: Update comment. 2026-01-02 07:45:14 +01:00
tutorials ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
AUTHORS Update files for Emacs 30.2 2025-08-14 04:05:28 -04:00
CALC-NEWS ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
ChangeLog.1 ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
compilation.txt ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
COPYING
copyright-assign.txt Add assignment form as etc/copyright-assign.txt 2024-06-23 00:24:31 +02:00
DEBUG ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
DEVEL.HUMOR ; Fix punctuation in etc/* 2024-07-27 01:51:47 +02:00
DISTRIB ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
edt-user.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
EGLOT-NEWS Eglot: spectacular optimization in files with many diagnostics 2026-01-11 03:42:01 +00:00
emacs-buffer.gdb ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
emacs-mail.desktop
emacs.desktop
emacs.icon
emacs.metainfo.xml ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
emacs.service
emacs_lldb.py ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
emacsclient-mail.desktop
emacsclient.desktop
enriched.txt ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
ERC-NEWS ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
ETAGS.EBNF ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
ETAGS.README ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
future-bug ; Fix typos 2025-01-23 03:14:37 +01:00
gnus-tut.txt ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
grep.txt ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
HELLO ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
HISTORY Update files for Emacs 30.2 2025-08-14 04:05:28 -04:00
JOKES
MACHINES ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
MH-E-NEWS ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
NEWS hideshow: Reword documentation (bug#80116) 2026-01-10 14:55:55 +02:00
NEWS.1-17 ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
NEWS.18 ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
NEWS.19 ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
NEWS.20 ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
NEWS.21 ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
NEWS.22 ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
NEWS.23 ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
NEWS.24 ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
NEWS.25 ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
NEWS.26 ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
NEWS.27 ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
NEWS.28 ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
NEWS.29 ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
NEWS.30 ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
NEXTSTEP ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
NXML-NEWS ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
ORG-NEWS ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
org.gnu.emacs.defaults.gschema.xml ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
package-keyring.gpg * etc/package-keyring.gpg: Update expiration and add new key 2024-10-22 12:35:18 -04:00
PROBLEMS ; Mention in PROBLEMS the issue with XIM character-selection window 2026-01-03 12:30:12 +02:00
ps-prin0.ps ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
ps-prin1.ps ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
publicsuffix.txt ; * etc/publicsuffix.txt: Update from upstream. 2024-12-22 13:50:41 +02:00
README ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
rgb.txt
ses-example.ses ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
spook.lines
symbol-releases.eld ; * etc/symbol-releases.eld (dired-click-to-select-mode): Add. 2025-08-23 16:34:43 +03:00
TERMS ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
TODO ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
w32-feature.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00

This directory contains the architecture-independent files used by or
with Emacs.  This includes some text files of documentation for GNU
Emacs or of interest to Emacs users, and the file of dumped docstrings
for Emacs functions and variables.

COPYRIGHT AND LICENSE INFORMATION FOR IMAGE FILES

File: emacs.icon
  Author: Sun Microsystems, Inc
  Copyright (C) 1999, 2001-2026 Free Software Foundation, Inc.
  License: GNU General Public License version 3 or later (see COPYING)