[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#61726: [PATCH] Eglot: Support positionEncoding capability
From: |
João Távora |
Subject: |
bug#61726: [PATCH] Eglot: Support positionEncoding capability |
Date: |
Sun, 26 Feb 2023 10:33:39 +0000 |
On Sun, Feb 26, 2023 at 6:03 AM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Augusto Stoffel <arstoffel@gmail.com>
> > Cc: Eli Zaretskii <eliz@gnu.org>, 61726@debbugs.gnu.org
> > Date: Sun, 26 Feb 2023 00:57:42 +0100
> >
> > The linear cousin of "lsp-abiding" is very similar to the
> > function that Eli wrote:
> >
> > (defun eglot-move-to-lsp-abiding-column-linearly (column)
> > "Move to COLUMN as computed using the LSP `utf-16' criterion."
> > (let* ((bol (line-beginning-position))
> > (goal-char (+ bol column))
> > (eol (line-end-position)))
> > (goto-char bol)
> > (while (and (< (point) goal-char)
> > (< (point) eol))
> > (if (<= #x010000 (char-after) #x10ffff)
> > (setq goal-char (1- goal-char)))
> > (forward-char 1))))
> >
> > It would be very hard to believe they have different performance
> > characteristics. In fact, in some hastily done tests, I get the
> > following relative running times:
> >
> > eglot-move-to-colum: 1.0
> > eglot-move-to-lsp-abiding-column-linearly: 8.4
> > eglot-move-to-bytewise-column: 8.0
> > eglot-move-to-lsp-abiding-column: 14.4
>
> The current version of eglot-move-to-lsp-abiding-column calls
> encode-coding-region in the loop, which I guess is the main reason for
> its being slower.
Yup, here's a surprise. We don't need encode-coding-region
after all and the binary search I implemented back in
https://github.com/joaotavora/eglot/pull/125
is mostly useless. In that issue, noone thought of counting
characters by examining the code point values and counting
code units.
So I pushed this much faster, simpler version to emacs-29.
I credited Eli in the commit, as we wrote the code. Hope
that's OK.
João
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, (continued)
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, Eli Zaretskii, 2023/02/25
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, Augusto Stoffel, 2023/02/25
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, Eli Zaretskii, 2023/02/25
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, Augusto Stoffel, 2023/02/25
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, João Távora, 2023/02/25
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, João Távora, 2023/02/25
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, Augusto Stoffel, 2023/02/25
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, João Távora, 2023/02/25
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, Augusto Stoffel, 2023/02/25
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, Eli Zaretskii, 2023/02/26
- bug#61726: [PATCH] Eglot: Support positionEncoding capability,
João Távora <=
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, João Távora, 2023/02/26
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, Eli Zaretskii, 2023/02/26
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, Eli Zaretskii, 2023/02/26
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, João Távora, 2023/02/26
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, Eli Zaretskii, 2023/02/26
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, João Távora, 2023/02/26
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, Eli Zaretskii, 2023/02/26
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, João Távora, 2023/02/27
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, Eli Zaretskii, 2023/02/26
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, João Távora, 2023/02/26