From: Dmitry Gutov <dgutov@yandex.ru>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 53749@debbugs.gnu.org, Ikumi Keita <ikumi@ikumi.que.jp>,
David Fussner <dfussner@googlemail.com>,
Arash Esbati <arash@gnu.org>,
stefankangas@gmail.com, Tassilo Horn <tsdh@gnu.org>,
Eli Zaretskii <eliz@gnu.org>
Subject: bug#53749: 29.0.50; [PATCH] Xref backend for TeX buffers
Date: Wed, 15 May 2024 00:24:24 +0300 [thread overview]
Message-ID: <82993b86-0f34-4adb-a392-c74db5176d14@yandex.ru> (raw)
In-Reply-To: <jwv7cfxihg2.fsf-monnier+emacs@gnu.org>
On 13/05/2024 23:54, Stefan Monnier via Bug reports for GNU Emacs, the
Swiss army knife of text editors wrote:
>> For now, I've pushed a fix in 86187d43e2d which seems to handle David's
>> scenario and address your review comment as well.
>
> The let-binding is done outside of `with-current-buffer`, so it relies
> on the fact (itself problematic) that `inhibit-modification-hooks` is
> not buffer-local.
Good point.
> Would it be OK to use a patch like the one below?
Sure, thank you. Pushed.
> IIUC, in the `syntax-needed` case, the let-binding of
> `inhibit-modification-hooks` is just not useful very (4-7% is not worth
> the trouble), so its purpose is to speed up the other case.
4-10% is the improvement for both cases (the "syntax needed" and not).
I could be on the fence whether it's "not useful" - on the one hand 4%
might not sound like much - on the other we already have this bit of
improvement which has no known bugs. And when you combine a few of such
performance hacks, the difference gets more noticeable.
Also, I'm eyeing another performance improvement (simplifying file type
detection) - the call to set-auto-mode is not fast. Simply commenting
this call out improves the performance by 4x or so - but we'll need a
simpler version of it instead, of course.
And with the above change (commenting out the set-auto-mode call), the
difference that the inhibit-modification-hooks hack makes is amplified:
it can get up to 20%. Ultimately it'll be somewhere in between, but this
sounds better, right?
> Also, what about the other two bindings of `inhibit-modification-hooks`?
The other two are used while the contents of the Xref buffer are printed
(or re-printed), so there's none of the syntax-ppss complications there.
The performance difference is 8.5% in my last measurement.
>
> Stefan
>
>
> diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
> index f9faec1b474..214e9cb6c09 100644
> --- a/lisp/progmodes/xref.el
> +++ b/lisp/progmodes/xref.el
> @@ -1282,7 +1282,7 @@ xref--show-common-initialize
> (erase-buffer)
> (setq overlay-arrow-position nil)
> (xref--insert-xrefs xref-alist)
> - (add-hook 'post-command-hook 'xref--apply-truncation nil t)
> + (add-hook 'post-command-hook #'xref--apply-truncation nil t)
> (goto-char (point-min))
> (setq xref--original-window (assoc-default 'window alist)
> xref--original-window-intent (assoc-default 'display-action alist))
> @@ -2112,10 +2112,7 @@ xref--convert-hits
> (defun xref--collect-matches (hit regexp tmp-buffer syntax-needed)
> (pcase-let* ((`(,line ,file ,text) hit)
> (file (and file (concat xref--hits-remote-id file)))
> - (buf (xref--find-file-buffer file))
> - ;; This is fairly dangerouns, but improves performance
> - ;; for large lists, see https://debbugs.gnu.org/53749#227
> - (inhibit-modification-hooks t))
> + (buf (xref--find-file-buffer file)))
> (if buf
> (with-current-buffer buf
> (save-excursion
> @@ -2130,6 +2130,9 @@
> ;; Using the temporary buffer is both a performance and a buffer
> ;; management optimization.
> (with-current-buffer tmp-buffer
> + ;; This let is fairly dangerouns, but improves performance
> + ;; for large lists, see https://debbugs.gnu.org/53749#227
> + (let ((inhibit-modification-hooks t))
> (erase-buffer)
> (when (and syntax-needed
> (not (equal file xref--temp-buffer-file-name)))
> @@ -2144,7 +2147,7 @@
> (setq-local xref--temp-buffer-file-name file)
> (setq-local inhibit-read-only t)
> (erase-buffer))
> - (insert text)
> + (insert text))
> (goto-char (point-min))
> (when syntax-needed
> (syntax-ppss-flush-cache (point)))
>
>
>
>
next prev parent reply other threads:[~2024-05-14 21:24 UTC|newest]
Thread overview: 92+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-03 15:09 bug#53749: 29.0.50; [PATCH] Xref backend for TeX buffers David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-21 2:11 ` Dmitry Gutov
2022-02-21 9:48 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-21 17:28 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-21 23:56 ` Dmitry Gutov
2022-02-22 15:19 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-23 2:21 ` Dmitry Gutov
2022-02-23 10:45 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-24 2:23 ` Dmitry Gutov
2022-02-24 13:15 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-21 23:55 ` Dmitry Gutov
2022-09-08 13:25 ` Lars Ingebrigtsen
2022-09-08 13:34 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-08 13:39 ` Lars Ingebrigtsen
2022-09-08 15:50 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-03 9:08 ` Stefan Kangas
2023-09-03 10:03 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-03 10:46 ` Stefan Kangas
2023-09-13 11:10 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-13 13:42 ` Stefan Kangas
2023-09-13 15:23 ` Dmitry Gutov
2023-09-13 17:01 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-13 23:59 ` Dmitry Gutov
2023-09-14 6:10 ` Eli Zaretskii
2023-09-15 18:45 ` Tassilo Horn
2023-09-16 5:53 ` Ikumi Keita
2023-09-17 8:49 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-22 13:06 ` Arash Esbati
2024-04-22 14:56 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-22 16:15 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-22 16:37 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-22 17:16 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-22 17:25 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-24 0:09 ` Dmitry Gutov
2024-04-24 9:02 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-23 12:04 ` Arash Esbati
2024-04-23 13:21 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-29 14:15 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-02 0:43 ` Dmitry Gutov
2024-05-02 13:32 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-03 13:42 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-07 2:27 ` Dmitry Gutov
2024-05-09 3:00 ` Dmitry Gutov
2024-05-09 6:38 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-09 10:49 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-13 20:54 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-14 21:24 ` Dmitry Gutov [this message]
2024-05-16 18:18 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-20 0:21 ` Dmitry Gutov
2024-05-20 2:38 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-25 7:57 ` Eli Zaretskii
2024-06-05 9:46 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-08 12:38 ` Eli Zaretskii
2024-06-08 20:54 ` Dmitry Gutov
2024-06-09 11:10 ` Stefan Kangas
2024-06-09 11:36 ` Stefan Kangas
2024-06-09 18:42 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-09 18:45 ` Dmitry Gutov
2024-06-09 21:03 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-09 22:13 ` Dmitry Gutov
2024-06-10 13:29 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-25 23:01 ` Dmitry Gutov
2024-05-07 2:06 ` Dmitry Gutov
2024-05-02 6:47 ` Arash Esbati
2024-05-02 13:34 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-03 14:10 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-04 8:26 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-04 14:32 ` Arash Esbati
2024-05-04 14:54 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-04 21:15 ` Arash Esbati
2024-05-07 13:15 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-15 15:47 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-16 7:53 ` Arash Esbati
2024-05-16 12:56 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-14 16:11 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-14 23:55 ` Dmitry Gutov
2023-09-15 6:47 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-13 19:16 ` Eli Zaretskii
2023-09-13 20:25 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-14 5:14 ` Eli Zaretskii
2022-02-21 12:35 ` Arash Esbati
2022-02-21 14:03 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-25 20:16 ` Augusto Stoffel
2022-02-26 9:29 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-26 10:56 ` Augusto Stoffel
2022-02-27 18:42 ` Arash Esbati
2022-02-28 9:09 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-28 11:54 ` Arash Esbati
2022-02-28 13:11 ` Augusto Stoffel
2022-02-28 19:04 ` Arash Esbati
2022-03-01 8:46 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-28 13:05 ` Augusto Stoffel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=82993b86-0f34-4adb-a392-c74db5176d14@yandex.ru \
--to=dgutov@yandex.ru \
--cc=53749@debbugs.gnu.org \
--cc=arash@gnu.org \
--cc=dfussner@googlemail.com \
--cc=eliz@gnu.org \
--cc=ikumi@ikumi.que.jp \
--cc=monnier@iro.umontreal.ca \
--cc=stefankangas@gmail.com \
--cc=tsdh@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).