unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Yikai Zhao" <yikai@z1k.dev>,
	"Stefan Monnier" <monnier@iro.umontreal.ca>,
	"João Távora" <joaotavora@gmail.com>
Cc: 73766@debbugs.gnu.org
Subject: bug#73766: 30.0.91; (documentation 'pcase) can take several seconds
Date: Sat, 12 Oct 2024 12:22:13 +0300	[thread overview]
Message-ID: <86msj9y8u2.fsf@gnu.org> (raw)
In-Reply-To: <CANMyjpggTmsX0PKYxhadOqVNcMtasZb=tX6pV7FmLTLwyvQLkQ@mail.gmail.com> (message from Yikai Zhao on Sat, 12 Oct 2024 16:02:04 +0800)

> From: Yikai Zhao <yikai@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.





  reply	other threads:[~2024-10-12  9:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-12  8:02 bug#73766: 30.0.91; (documentation 'pcase) can take several seconds Yikai Zhao
2024-10-12  9:22 ` Eli Zaretskii [this message]
2024-10-12 16:39   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-13 14:10     ` Yikai Zhao

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=86msj9y8u2.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=73766@debbugs.gnu.org \
    --cc=joaotavora@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    --cc=yikai@z1k.dev \
    /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).