help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Too long completion delay time in LISP interaction mode.


From: Hongyi Zhao
Subject: Re: Too long completion delay time in LISP interaction mode.
Date: Wed, 20 Oct 2021 15:24:24 +0800

On Wed, Oct 20, 2021 at 2:42 PM Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>
> On Wed, Oct 20, 2021 at 2:25 PM Tassilo Horn <tsdh@gnu.org> wrote:
> >
> > Hongyi Zhao <hongyi.zhao@gmail.com> writes:
> >
> > >> So the bottleneck is in the lambda which you didn't expand.
> > >
> > > I disabled hotfuzz now, and the following result is obtained by
> > > profiling the CPU with the same steps as described above:
> > >
> > >          472  88% - command-execute
> > >          472  88%  - funcall-interactively
> > >          472  88%   - counsel-M-x
> > >          472  88%    - let
> > >          448  84%     - ivy-read
> > >          448  84%      - apply
> > >          444  83%       + #<lambda 0x1b03f67daa2b12f2>
> > >            4   0%       + my/company--transform-candidates
> > >           24   4%     + counsel--M-x-externs
> > >           45   8% + ...
> > >           15   2% + redisplay_internal (C function)
> >
> > Well, again you didn't expand the lambda where most of the time is
> > spent...
>
> To be frank, I don't know how to expand it.

Shame on me. It can be expanded by clicking the + sign again and
again. See the following:

         495  86% - command-execute
         495  86%  - funcall-interactively
         487  85%   - counsel-M-x
         487  85%    - let
         458  80%     - ivy-read
         458  80%      - apply
         454  79%       - #<lambda 0x1de0670da47deef2>
         454  79%        - let*
         454  79%         - progn
         454  79%          - progn
         454  79%           - let*
         404  70%            - ivy--reset-state
         404  70%             - let*
         404  70%              - let
         344  60%               - if
         340  59%                - progn
         340  59%                 - setq
         336  58%                  - sort
         308  54%                   - ivy-prescient-sort-function
         264  46%                    - prescient-sort-compare
         180  31%                     - let
         172  30%                      - progn
         160  28%                       - let*
         124  21%                        - or
         116  20%                         - and
          64  11%                          - let*
          36   6%                           - or
          32   5%                            - and
          20   3%                               <
           4   0%                     - if
           4   0%                        and
           4   0%                - and
           4   0%                   null
          60  10%               - cond
          60  10%                - let
          60  10%                 - setq
          44   7%                  - all-completions
          36   6%                   - #<lambda 0x543b56196f44733>
          36   6%                    - and
           4   0%                     - not
           4   0%                        get
          39   6%            - unwind-protect
          39   6%             - let
          39   6%              - unwind-protect
          39   6%               - progn
          39   6%                - let*
          39   6%                 - if
          39   6%                  - condition-case
          35   6%                   - read-from-minibuffer
          21   3%                    - ivy--queue-exhibit
          21   3%                     - if
          21   3%                      - ivy--exhibit
          21   3%                       - if
          21   3%                        - progn
          21   3%                         - let
          21   3%                          - ivy--update-minibuffer
          21   3%                           - prog1
          21   3%                            - if
          11   1%                             - save-current-buffer
          11   1%                              + ivy--format
          10   1%                             + progn
           3   0%                    + redisplay_internal (C function)
          11   1%            + ivy-call
           4   0%       + posframe-show
          29   5%     - counsel--M-x-externs
          29   5%        cond
           8   1%   - self-insert-command
           8   1%    - hideshowvis-highlight-hs-regions-in-fringe
           8   1%     - if
           8   1%      - progn
           8   1%       - save-excursion
           8   1%        - save-restriction
           8   1%           while
          65  11% - ...
          44   7%  - completion-all-completions
          44   7%   - completion--nth-completion
          44   7%    - completion--some
          44   7%     - #<compiled 0x194abcb52c81cd5e>
          44   7%      - orderless-all-completions
          44   7%       - let
          44   7%        - orderless-filter
          44   7%         - let
          44   7%          - unwind-protect
          44   7%           - progn
          44   7%            - let*
          44   7%             - progn
          44   7%              - let*
          44   7%               - let
          44   7%                - let*
          44   7%                   progn
          13   2%  - window-text-pixel-size
          13   2%   - jit-lock-function
          13   2%    - jit-lock-fontify-now
          13   2%     - jit-lock--run-functions
          13   2%      - run-hook-wrapped
          13   2%       - #<compiled 0x19ba2d83e5235cbd>
          13   2%        - adaptive-wrap-prefix-function
          13   2%         - while
          13   2%          - let
           5   0%           - company-call-backend
           5   0%            - company--force-sync
           5   0%             - let
           5   0%              - apply
           5   0%               - company-call-backend-raw
           5   0%                - condition-case
           5   0%                 - if
           5   0%                  - apply
           5   0%                   - company-capf
           5   0%                    - apply
           5   0%                     - company-anywhere-capf
           5   0%                      - if
           5   0%                       - apply
           5   0%                        - #<lambda -0x10ca152207b458d5>
           5   0%                           cond
           4   0%           - nconc
           4   0%            - if
           4   0%             - orderless-highlight-matches
           4   0%              - let*
           4   0%               - while
           4   0%                - setq
           4   0%                 - cons
           4   0%                  - orderless--highlight
           4   0%                   - let*
           4   0%                    - let
           4   0%                     - while
           4   0%                      - if
           4   0%                       - progn
           4   0%                        - let*
           4   0%                           let
           4   0%           - put-text-property
           4   0%            - let
           4   0%             - adaptive-wrap-fill-context-prefix
           4   0%              - let*
           4   0%               - or
           4   0%                - let
           4   0%                   fill-context-prefix
           8   1%  - ivy--filter
           8   1%   - let
           8   1%    - if
           8   1%     - let*
           8   1%      - cond
           8   1%       - ivy--re-filter
           8   1%        - if
           8   1%         - condition-case
           8   1%          - progn
           8   1%           - let
           8   1%            - while
           8   1%             - let
           8   1%              - let*
           8   1%               - setq
           4   0%                + company-calculate-candidates
           4   0%                + cl-remove
           0   0%    Automatic GC
          10   1% + redisplay_internal (C function)



> > >> But I'm also not sure if you are profiling the right thing because I
> > >> don't think that in-buffer completion (in terms of
> > >> `completion-at-point-functions') starts with M-x (or counsel-M-x).
> > >
> > > I'm not sure if it's relevant to the following configuration in my
> > > `~/.emacs.d/init.el':
> >
> > I also use corfu but I think now I know what happens.  The thing is that
> > doing M-x profiler-report RET takes much longer (88% of the profiling
> > time) than computing the completion candidates.  That is done in the
> >
> >     45   8% + ...
> >
> > part which you should also expand.
>
> Again, I don't know how to expand it.
>
> > When I do your recipe, the first 54% part is also the M-x
> > profiler-report RET part, and the
> >
> >          327  45% - ...
> >
> > is the actual completion part (using vertico).
>
> I don't use corfu [1] and vertico [2], but thank you for letting me
> your configuration.
>
> [1] https://github.com/minad/corfu
> [2] https://github.com/minad/vertico
>
>
> > --8<---------------cut here---------------start------------->8---
> >          391  54% - command-execute
> >          391  54%  - call-interactively
> >          390  53%   - byte-code
> >          390  53%    - read-extended-command
> >          390  53%     - completing-read
> >          390  53%      - completing-read-default
> >          390  53%       - apply
> >          390  53%        - vertico--advice
> >          390  53%         - apply
> >          390  53%          - #<compiled 0x8411fe8870440ec>
> >          375  51%           - read-from-minibuffer
> >          357  49%            + vertico--exhibit
> >            5   0%            + command-execute
> >            1   0%   + funcall-interactively
> >          327  45% - ...
> >          265  36%  - or
> >          265  36%   - if
> >          265  36%    - let*
> >          260  35%     - unwind-protect
> >          260  35%      - progn
> >          129  17%       + corfu--recompute-candidates
> >          121  16%       + let*
> >           10   1%       + if
> >            5   0%     + if
> >           62   8%    Automatic GC
> >            5   0% + timer-event-handler
> > --8<---------------cut here---------------end--------------->8---
>
> Anyway, after disabling the hotfuzz, the completion delay has been
> reduced to an acceptable time.
>
> [3] https://github.com/axelf4/hotfuzz
>
> HZ



reply via email to

[Prev in Thread] Current Thread [Next in Thread]