Subject: bug#66512: 30.0.50; flymake with checkdoc slows down typing in large Elisp buffers

From: Eli Zaretskii <[email-masked]>
Date: Fri, 13 Oct 2023 09:37:35 +0300

> From: Visuwesh <[email-masked]>
> Date: Fri, 13 Oct 2023 11:23:31 +0530
> 
> flymake-mode is largely unusable in large Elisp buffers with checkdoc
> enabled as it sometimes takes a second for the typed words to be
> displayed, and there are too many micro freezes.  I have attached two
> profiles one from emacs -Q, and one from my personal configuration saved
> using the command profiler-report-write-profile.  Both point to
> checkdoc-this-string-valid being the time consuming function.
> 
> To reproduce,
> 
>     1. src/emacs -Q
>     2. C-x C-f lisp/org/org.el RET
>     3. M-x flymake-mode RET
>     4. M-g i org-drag-line-forward RET
>     5. Move the point to be inside the docstring, and start typing away.
>        You should notice the latency sooner or later.
> 
> I can reproduce this in my fairly long init.el file too (~10k lines) and
> I was forced to turn off checkdoc for the typing to be bearable in my
> init.el file.

Thanks.

This report needs more info:

  . the file you used which produces this slowdown
  . the profile is not fully expanded (some functions have "+")
  . for more detailed profile, please load the relevant Lisp files as
    *.el (not *.elc), and repeat the profiling
  . if the slowdown is visible in "emacs -Q", the profile from that is
    more important than the one from your customized Emacs