unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to improve the speed of files list reading under directory in completion
@ 2021-11-06 16:12 Christopher M. Miles
  0 siblings, 0 replies; only message in thread
From: Christopher M. Miles @ 2021-11-06 16:12 UTC (permalink / raw)
  To: Emacs Help


[-- Attachment #1.1: Type: text/plain, Size: 809 bytes --]


I'm using =vertico= and =marginalia= to get minibuffer completion.

When I press =[C-x C-f]= to try to open a file under current directory (this directory is on home QNAP
NAS and contains 4356 files). But it took 3 seconds to show up candidates, when I input one
character, filtering is also very slow.

#+begin_src shell
ls -l | wc -l
#+end_src

#+RESULTS[(2021-11-07 00:07:42) 8103eabbf0c6408f1637cafcb1621f3abd36f61d]:
:     4356

Then I toke Emacs built-in profiler benchmarking, I attached the result in to email attachment files.

-- 
[ stardiviner ]
       I try to make every word tell the meaning that I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


[-- Attachment #1.2: profiler cpu report --]
[-- Type: #("text/plain" 0 10 (face nil)), Size: 4629 bytes --]

         516  94% - command-execute
         516  94%  - call-interactively
         512  93%   - byte-code
         377  68%    - read-extended-command
         377  68%     - completing-read
         377  68%      - completing-read-default
         377  68%       - apply
         377  68%        - vertico--advice
         377  68%         - apply
         377  68%          - #<compiled 0x113d1049c73aa030>
         296  54%           - read-from-minibuffer
         249  45%            - vertico--exhibit
         247  45%             - vertico--update-candidates
         246  44%              - vertico--recompute-candidates
         227  41%               - vertico--all-completions
         227  41%                - apply
         227  41%                 - completion-all-completions
         227  41%                  - apply
         227  41%                   - #<compiled -0x1999625b108ade72>
         227  41%                    - completion--nth-completion
         198  36%                     - completion--some
         198  36%                      - #<compiled -0x37300705e7fa81d>
         153  27%                       - completion-basic-all-completions
         153  27%                        - completion-pcm--all-completions
         153  27%                         - all-completions
         153  27%                          - #<compiled -0x74309870587b6d9>
         153  27%                           - complete-with-action
           7   1%                            - all-completions
           5   0%                             - #<compiled -0x1cf269cc38aaf70c>
           2   0%                                #<compiled 0x45d551481091498>
          45   8%                       + completion-pcm-all-completions
          29   5%                     + #<compiled 0x14a0f6c5e0a2f052>
          12   2%                 redisplay
           1   0%               + vertico-sort-history-length-alpha
           1   0%              + test-completion
          14   2%            + timer-event-handler
           3   0%            + minibuffer-mode
           3   0%            + minibuffer-inactive-mode
           1   0%            + redisplay_internal (C function)
         135  24%    - find-file-read-args
         135  24%     - read-file-name
         135  24%      - read-file-name-default
         134  24%       - completing-read
         134  24%        - completing-read-default
         134  24%         - apply
         134  24%          - vertico--advice
         134  24%           - apply
         134  24%            - #<compiled 0x113d1049c73aa030>
          71  12%             - read-from-minibuffer
          25   4%              - vertico--exhibit
          14   2%               - vertico--arrange-candidates
          13   2%                - vertico--affixate
          13   2%                 - #<compiled 0x13f64ed1f18bb99b>
          13   2%                  - mapcar
          13   2%                   - #<compiled 0x3415c4798ba58fe>
          13   2%                    - marginalia--cached
           7   1%                     - marginalia-annotate-command
           6   1%                        marginalia--function-doc
           1   0%                        marginalia-annotate-binding
           6   1%                     - marginalia-annotate-file
           6   1%                      - marginalia--annotate-local-file
           1   0%                         marginalia--file-owner
           1   0%                  vertico--format-candidate
           9   1%               + vertico--update-candidates
           2   0%               + vertico--display-candidates
          14   2%              - timer-event-handler
          14   2%               - apply
          14   2%                  #<compiled 0x12cd0f4697e83df6>
           3   0%              + minibuffer-inactive-mode
           2   0%              + minibuffer-mode
           1   0%         abbreviate-file-name
           4   0%   + funcall-interactively
          22   4% - ...
          22   4%    Automatic GC
           6   1% - redisplay_internal (C function)
           4   0%  - eval
           3   0%   - doom-modeline-segment--buffer-info
           3   0%      doom-modeline-update-buffer-file-state-icon
           1   0%   + cond
           1   0%  + #<compiled -0x194f5907b4677b6d>
           1   0%  + menu-bar-update-buffers
           1   0% + global-font-lock-mode-check-buffers
           1   0% + #<compiled -0x2222a52d2f12599>
           1   0% + winner-save-old-configurations

[-- Attachment #1.3: profiler memory report --]
[-- Type: #("text/plain" 0 10 (face nil)), Size: 8774 bytes --]

     10,151,482  99% - command-execute
     10,151,482  99%  - call-interactively
      7,494,064  73%   - byte-code
      5,899,148  57%    - find-file-read-args
      5,899,148  57%     - read-file-name
      5,899,148  57%      - read-file-name-default
      5,895,052  57%       - completing-read
      5,895,052  57%        - completing-read-default
      5,895,052  57%         - apply
      5,895,052  57%          - vertico--advice
      5,895,052  57%           - apply
      5,895,052  57%            - #<compiled 0x113d1049c73aa030>
      5,862,492  57%             - read-from-minibuffer
      5,301,415  51%              - vertico--exhibit
      3,083,630  30%               - vertico--update-candidates
      3,071,326  29%                - vertico--recompute-candidates
      2,716,316  26%                 - vertico--all-completions
      2,712,172  26%                  - apply
      2,712,172  26%                   - completion-all-completions
      2,708,028  26%                    - apply
      2,708,028  26%                     - #<compiled -0x1999625b108ade72>
      2,708,028  26%                      - completion--nth-completion
      1,731,808  16%                       - #<compiled 0x14a0f6c5e0a2f052>
      1,731,808  16%                        - completion--twq-all
      1,695,864  16%                         - mapcar
      1,137,304  11%                          - #<compiled 0x1c4404fe36ecd570>
      1,134,160  11%                           - minibuffer-maybe-quote-filename
      1,133,136  11%                            - minibuffer--double-dollars
        872,688   8%                             - replace-regexp-in-string
        260,448   2%                                apply
        976,220   9%                       - completion--some
        976,220   9%                        - #<compiled -0x37300705e7fa81d>
        905,916   8%                         - completion-pcm-all-completions
        905,916   8%                          - completion-pcm--find-all-completions
        902,844   8%                           - completion-pcm--all-completions
        901,820   8%                            - all-completions
        901,820   8%                             - completion-file-name-table
        227,596   2%                              - file-name-all-completions
        223,452   2%                               - ucs-normalize-hfs-nfd-post-read-conversion
        215,164   2%                                - ucs-normalize-HFS-NFC-region
        211,020   2%                                   ucs-normalize-region
          1,024   0%                              completion-pcm--pattern->regex
          3,072   0%                             completion-pcm--string->pattern
         62,120   0%                         + completion-basic-all-completions
          4,144   0%                    + marginalia--base-position
        279,824   2%                 + vertico--filter-files
         62,546   0%                   redisplay
          4,144   0%                 + vertico-sort-history-length-alpha
          3,072   0%                  vertico--remote-p
      1,178,197  11%               - vertico--display-candidates
      1,151,749  11%                - vertico--resize-window
      1,055,653  10%                 - window-resize
      1,055,653  10%                    window--resize-mini-window
         26,448   0%                  apply
      1,024,412   9%               - vertico--arrange-candidates
        873,772   8%                - vertico--affixate
        873,772   8%                 - #<compiled 0x13f64ed1f18bb99b>
        873,772   8%                  - mapcar
        873,772   8%                   - #<compiled 0x3415c4798ba58fe>
        873,772   8%                    - marginalia--cached
        562,828   5%                     - marginalia-annotate-command
        451,584   4%                        marginalia-annotate-binding
         83,620   0%                      + marginalia--function-doc
         27,624   0%                      + marginalia--documentation
        310,944   3%                     - marginalia-annotate-file
        290,952   2%                      - marginalia--annotate-local-file
        227,600   2%                       - file-attributes
        227,600   2%                        - ucs-normalize-hfs-nfd-pre-write-conversion
        227,600   2%                         - ucs-normalize-HFS-NFD-region
        227,600   2%                            ucs-normalize-region
         10,848   0%                       + marginalia--time
          7,232   0%                         marginalia--align
          1,600   0%                         marginalia--full-candidate
          1,048   0%                         file-size-human-readable
          7,216   0%                        marginalia--remote-protocol
        100,800   0%                + vertico--format-candidate
          9,048   0%                  seq-subseq
          7,176   0%                + #<compiled 0x10ec31785956852e>
          6,000   0%               + vertico--display-count
          5,120   0%               + completion-boundaries
          2,048   0%               + completion-metadata
            320   0%                 vertico--prompt-selection
          9,933   0%              + redisplay_internal (C function)
          9,816   0%              + timer-event-handler
          9,472   0%              + rfn-eshadow-update-overlay
          8,200   0%              + minibuffer-mode
          4,176   0%                minibuf-eldef-setup-minibuffer
          4,144   0%              + marginalia--minibuffer-setup
          4,144   0%              + winner-save-unconditionally
            320   0%              + rfn-eshadow-setup-minibuffer
             96   0%              + undo-auto--undoable-change
             64   0%              + command-execute
             32   0%              + minibuffer-inactive-mode
          2,048   0%         abbreviate-file-name
          2,048   0%       + minibuffer-maybe-quote-filename
      1,594,916  15%    - read-extended-command
      1,594,916  15%     - completing-read
      1,594,916  15%      - completing-read-default
      1,594,916  15%       - apply
      1,594,916  15%        - vertico--advice
      1,594,916  15%         - apply
      1,594,916  15%          - #<compiled 0x113d1049c73aa030>
      1,560,692  15%           - read-from-minibuffer
        746,405   7%            - vertico--exhibit
        363,157   3%             - vertico--display-candidates
        354,973   3%              - vertico--resize-window
          8,184   0%               + default-line-height
            613   0%               + window-resize
          8,184   0%                apply
        258,120   2%             - vertico--update-candidates
        258,120   2%              - vertico--recompute-candidates
        252,728   2%               - redisplay
         17,048   0%                - redisplay_internal (C function)
         17,048   0%                 - #<compiled -0x194f5907b4677b6d>
         17,048   0%                  - apply
         17,048   0%                   - zoom--handler
         17,048   0%                    - apply
         17,048   0%                     - #<compiled 0x902fa518a07c213>
         16,000   0%                      + zoom--get-frame-snapshot
          4,144   0%               + vertico-sort-history-length-alpha
         89,288   0%             + vertico--arrange-candidates
         32,000   0%             + vertico--display-count
          1,280   0%               vertico--prompt-selection
         83,361   0%            + redisplay_internal (C function)
          9,304   0%            + timer-event-handler
          8,288   0%            + marginalia--minibuffer-setup
          4,176   0%              minibuf-eldef-setup-minibuffer
          4,160   0%            + minibuffer-mode
          4,048   0%            + command-execute
          2,096   0%            + minibuffer-inactive-mode
      2,657,418  25%   - funcall-interactively
      2,657,418  25%    - execute-extended-command
      2,657,370  25%     - command-execute
      2,657,370  25%      - call-interactively
      2,657,354  25%       - funcall-interactively
      2,656,640  25%          profiler-report
            714   0%          profiler-start
             48   0%     + run-at-time
         91,004   0% + redisplay_internal (C function)
          4,144   0% + winner-save-old-configurations
          1,048   0% + timer-event-handler
             21   0% + #<compiled -0x2222a52d2f12599>
              0   0%   ...

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-06 16:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-06 16:12 How to improve the speed of files list reading under directory in completion Christopher M. Miles

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).