Subject: Re: bug#73766: 30.0.91; (documentation 'pcase) can take several seconds

From: Stefan Monnier <[email-masked]>
Date: Fri, 18 Oct 2024 13:04:54 -0400

>>     diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
>>     index 5a7f3995311..811d42793cd 100644
>>     --- a/lisp/emacs-lisp/pcase.el
>>     +++ b/lisp/emacs-lisp/pcase.el
>>     @@ -214,7 +214,7 @@ pcase--make-docstring
>>                    (save-excursion
>>                      (forward-char -1)
>>                      (insert (format-message "  in `"))
>>     -                (help-insert-xref-button (help-fns-short-filename filename)
>>     +                (help-insert-xref-button (file-name-nondirectory filename)
>>                                               'help-function-def symbol filename
>>                                               'pcase-macro)
>>                      (insert (format-message "'."))))
>
> I'd prefer the last alternative for emacs-30, but then you say:

Thanks, will do.

>> There's still a remaining performance issue for things like
>> `eldoc-mode`, admittedly where we'd really want it to be instantaneous,
>> but I think this should be fixed by making `eldoc` call `documentation`
>> in a special way to skips those useless computations (eldoc just wants
>> a "short doc" anyway).  This affects other functions using the
>> `function-documentation` property in a similar way.
> Does it mean that this slowdown of eldoc was also caused by commit
> 052c2ce0284c5193c9d6768a45a9b3508af51230, and if so, does the patch
> you've shown previously (and which you consider not safe enough for
> emacs-30) solve the eldoc slowdown as well?

What I meant is that the 4s slowdown affects both `C-h f` and eldoc,
and that the patch I sent which reduces it to 0.12s is IMO sufficient
for the `C-h f` case but may still make Emacs feel occasionally a bit
sluggish when eldoc hits this 0.12s.

        Stefan