GNU bug report logs - #73766
30.0.91; (documentation 'pcase) can take several seconds

Previous Next

Package: emacs;

Reported by: Yikai Zhao <yikai <at> z1k.dev>

Date: Sat, 12 Oct 2024 08:03:01 UTC

Severity: normal

Found in version 30.0.91

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 73766 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Yikai Zhao <yikai <at> z1k.dev>, Stefan Monnier <monnier <at> iro.umontreal.ca>,
 João Távora <joaotavora <at> gmail.com>
Cc: 73766 <at> debbugs.gnu.org
Subject: Re: bug#73766: 30.0.91;
 (documentation 'pcase) can take several seconds
Date: Sat, 12 Oct 2024 12:22:13 +0300
> From: Yikai Zhao <yikai <at> z1k.dev>
> Date: Sat, 12 Oct 2024 16:02:04 +0800
> 
> When `lsp-mode` is loaded, `(documentation 'pcase)` can take several
> seconds to complete.
> 
> Apparently, it would iterate over all defined pcase macros (N), and for
> each of those, `help-fns-short-filename` would iterate over all items in
> `load-path` (M). Total time complexity is N*M.
> 
> In my case, N is about ~400 (defined in lsp-protocols.el) and M is about
> ~100 (I think it's a normal case?).
> 
> This is especially problematic since the `documentation` method can be
> invoked by eldoc, which affects the responsiveness during editing.
> 
> --
> 
> Here's my profiler result:
> 
>         2713  86% - timer-event-handler
>         2713  86%  - apply
>         2707  86%   - #<native-comp-function
> F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_12>
>         2707  86%    - eldoc-print-current-symbol-info
>         2707  86%     - eldoc--invoke-strategy
>         2707  86%      - eldoc-documentation-default
>         2707  86%       - #<native-comp-function
> F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_17>
>         2707  86%        - elisp-eldoc-funcall
>         2707  86%         - elisp-get-fnsym-args-string
>         2707  86%          - documentation
>         2707  86%           - pcase--make-docstring
>         2606  82%            - help-fns-short-filename
>         2598  82%             - file-relative-name
>          335  10%                file-remote-p
>           27   0%                string-prefix-p

Adding Stefan and João, in case they have some comments or
suggestions.




This bug report was last modified 299 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.