Subject: Re: bug#53749: 29.0.50; [PATCH] Xref backend for TeX buffers

From: Dmitry Gutov <[email-masked]>
Date: Tue, 7 May 2024 05:27:14 +0300

On 03/05/2024 16:42, Stefan Monnier via Bug reports for GNU Emacs, the 
Swiss army knife of text editors wrote:
>> Thanks for looking over the patch. Here's the recipe for the purported
>> bug in xref.el:
> The problem stems from xref.el's constant abuse of
> `inhibit-modification-hooks`.  Binding this var to t should be done only
> in exceptional circumstances and should ideally be accompanied by a
> comment explaining why it's necessary.

Well, the reason is performance: I've tried to wring out the most out of 
it, given that we have to parse the buffer for syntax in Elisp, and 
that'll always have a certain overhead.

The difference between inhibiting and not could be up to 20% of runtime.

David's fix makes things slower (just due to having us do the necessary 
work), but still has an edge over having no inhibit-modification-hooks.

That remaining improvement is around 4-7% in my testing, though, so 
maybe it's the point where we should prioritize simplicity.