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

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

Running swiper on a buffer which includes a long line is very time-consu


From: Hongyi Zhao
Subject: Running swiper on a buffer which includes a long line is very time-consuming.
Date: Thu, 9 Dec 2021 10:18:55 +0800

On Ubuntu 20.04.3 LTS, I use the self-compiled latest git master
version of Emacs, and I installed `swiper` as follows:
```emacs-lisp
(use-package swiper
  :bind ("C-s" . swiper))
```
Currently, I've the following value of `Info-directory-list`:
```
Info-directory-list is a variable defined in info.el.gz.

Value
("/home/werner/.emacs.d/straight/build/mwim/"
"/home/werner/.emacs.d/straight/build/highlight-indent-guides/"
"/home/werner/.emacs.d/straight/build/urgrep/"
"/home/werner/.emacs.d/straight/build/project/"
"/home/werner/.emacs.d/straight/build/xref/"
"/home/werner/.emacs.d/straight/build/wgrep/"
"/home/werner/.emacs.d/straight/build/ivy-rich/"
"/home/werner/.emacs.d/straight/build/ivy-xref/"
"/home/werner/.emacs.d/straight/build/counsel/"
"/home/werner/.emacs.d/straight/build/helpful/"
"/home/werner/.emacs.d/straight/build/elisp-refs/"
"/home/werner/.emacs.d/straight/build/swiper/"
"/home/werner/.emacs.d/straight/build/ivy/"
"/home/werner/.emacs.d/straight/build/orderless/"
"/home/werner/.emacs.d/straight/build/vertico/"
"/home/werner/.emacs.d/straight/build/corfu/"
"/home/werner/.emacs.d/straight/build/marginalia/"
"/home/werner/.emacs.d/straight/build/consult/"
"/home/werner/.emacs.d/straight/build/magit/"
"/home/werner/.emacs.d/straight/build/magit-section/"
"/home/werner/.emacs.d/straight/build/git-commit/"
"/home/werner/.emacs.d/straight/build/transient/"
"/home/werner/.emacs.d/straight/build/eldoc/"
"/home/werner/.emacs.d/straight/build/xr/"
"/home/werner/.emacs.d/straight/build/helm-bibtex/"
"/home/werner/.emacs.d/straight/build/bibtex-completion/"
"/home/werner/.emacs.d/straight/build/biblio/"
"/home/werner/.emacs.d/straight/build/biblio-core/"
"/home/werner/.emacs.d/straight/build/parsebib/"
"/home/werner/.emacs.d/straight/build/helm-ag/"
"/home/werner/.emacs.d/straight/build/google-this/"
"/home/werner/.emacs.d/straight/build/aggressive-indent/"
"/home/werner/.emacs.d/straight/build/highlight-parentheses/"
"/home/werner/.emacs.d/straight/build/smartparens/"
"/home/werner/.emacs.d/straight/build/mathpix.el/"
"/home/werner/.emacs.d/straight/build/mw-thesaurus/"
"/home/werner/.emacs.d/straight/build/stardiviner-sdcv.el/"
"/home/werner/.emacs.d/straight/build/showtip/"
"/home/werner/.emacs.d/straight/build/define-it/"
"/home/werner/.emacs.d/straight/build/wiki-summary/"
"/home/werner/.emacs.d/straight/build/pos-tip/"
"/home/werner/.emacs.d/straight/build/google-translate/"
"/home/werner/.emacs.d/straight/build/academic-phrases/"
"/home/werner/.emacs.d/straight/build/languagetool/"
"/home/werner/.emacs.d/straight/build/smart-compile/"
"/home/werner/.emacs.d/straight/build/pdf-tools/"
"/home/werner/.emacs.d/straight/build/tablist/"
"/home/werner/.emacs.d/straight/build/company-tabnine/"
"/home/werner/.emacs.d/straight/build/unicode-escape/"
"/home/werner/.emacs.d/straight/build/names/"
"/home/werner/.emacs.d/straight/build/company-math/"
"/home/werner/.emacs.d/straight/build/math-symbol-lists/"
"/home/werner/.emacs.d/straight/build/company-posframe/"
"/home/werner/.emacs.d/straight/build/company-dwim/"
"/home/werner/.emacs.d/straight/build/company-anywhere/"
"/home/werner/.emacs.d/straight/build/company-reftex/"
"/home/werner/.emacs.d/straight/build/company/"
"/home/werner/.emacs.d/straight/build/cdlatex/"
"/home/werner/.emacs.d/straight/build/auctex/"
"/home/werner/.emacs.d/straight/build/outshine/"
"/home/werner/.emacs.d/straight/build/outorg/"
"/home/werner/.emacs.d/straight/build/indent-tools/"
"/home/werner/.emacs.d/straight/build/yafolding/"
"/home/werner/.emacs.d/straight/build/hungry-delete/"
"/home/werner/.emacs.d/straight/build/adaptive-wrap/"
"/home/werner/.emacs.d/straight/build/real-auto-save/"
"/home/werner/.emacs.d/straight/build/editorconfig/"
"/home/werner/.emacs.d/straight/build/macrostep/"
"/home/werner/.emacs.d/straight/build/expand-region/"
"/home/werner/.emacs.d/straight/build/major-mode-hydra/"
"/home/werner/.emacs.d/straight/build/pretty-hydra/"
"/home/werner/.emacs.d/straight/build/ein/"
"/home/werner/.emacs.d/straight/build/with-editor/"
"/home/werner/.emacs.d/straight/build/polymode/"
"/home/werner/.emacs.d/straight/build/request/"
"/home/werner/.emacs.d/straight/build/websocket/"
"/home/werner/.emacs.d/straight/build/py-autopep8/"
"/home/werner/.emacs.d/straight/build/numpydoc/"
"/home/werner/.emacs.d/straight/build/sphinx-doc/"
"/home/werner/.emacs.d/straight/build/importmagic/"
"/home/werner/.emacs.d/straight/build/epc/"
"/home/werner/.emacs.d/straight/build/ctable/"
"/home/werner/.emacs.d/straight/build/concurrent/"
"/home/werner/.emacs.d/straight/build/deferred/"
"/home/werner/.emacs.d/straight/build/python-isort/"
"/home/werner/.emacs.d/straight/build/reformatter/"
"/home/werner/.emacs.d/straight/build/python-switch-quotes/"
"/home/werner/.emacs.d/straight/build/pyvenv/"
"/home/werner/.emacs.d/straight/build/comint-mime/"
"/home/werner/.emacs.d/straight/build/format-all/"
"/home/werner/.emacs.d/straight/build/language-id/"
"/home/werner/.emacs.d/straight/build/inheritenv/"
"/home/werner/.emacs.d/straight/build/yasnippet-snippets/"
"/home/werner/.emacs.d/straight/build/yasnippet/"
"/home/werner/.emacs.d/straight/build/lsp-origami/"
"/home/werner/.emacs.d/straight/build/origami/"
"/home/werner/.emacs.d/straight/build/helm-lsp/"
"/home/werner/.emacs.d/straight/build/helm/"
"/home/werner/.emacs.d/straight/build/helm-core/"
"/home/werner/.emacs.d/straight/build/popup/"
"/home/werner/.emacs.d/straight/build/async/"
"/home/werner/.emacs.d/straight/build/lsp-ui/"
"/home/werner/.emacs.d/straight/build/dap-mode/"
"/home/werner/.emacs.d/straight/build/lsp-treemacs/"
"/home/werner/.emacs.d/straight/build/treemacs/"
"/home/werner/.emacs.d/straight/build/cfrs/"
"/home/werner/.emacs.d/straight/build/posframe/"
"/home/werner/.emacs.d/straight/build/pfuture/"
"/home/werner/.emacs.d/straight/build/ace-window/"
"/home/werner/.emacs.d/straight/build/avy/"
"/home/werner/.emacs.d/straight/build/bui/"
"/home/werner/.emacs.d/straight/build/lsp-mode/"
"/home/werner/.emacs.d/straight/build/markdown-mode/"
"/home/werner/.emacs.d/straight/build/spinner/"
"/home/werner/.emacs.d/straight/build/flycheck/"
"/home/werner/.emacs.d/straight/build/let-alist/"
"/home/werner/.emacs.d/straight/build/pkg-info/"
"/home/werner/.emacs.d/straight/build/epl/"
"/home/werner/.emacs.d/straight/build/thingatpt-utils-core/"
"/home/werner/.emacs.d/straight/build/vterm/"
"/home/werner/.emacs.d/straight/build/general/"
"/home/werner/.emacs.d/straight/build/which-key/"
"/home/werner/.emacs.d/straight/build/hydra/"
"/home/werner/.emacs.d/straight/build/lv/"
"/home/werner/.emacs.d/straight/build/highlight-indentation/"
"/home/werner/.emacs.d/straight/build/ht/"
"/home/werner/.emacs.d/straight/build/f/"
"/home/werner/.emacs.d/straight/build/s/"
"/home/werner/.emacs.d/straight/build/list-utils/"
"/home/werner/.emacs.d/straight/build/anaphora/"
"/home/werner/.emacs.d/straight/build/a/"
"/home/werner/.emacs.d/straight/build/multi-term/"
"/home/werner/.emacs.d/straight/build/valign/"
"/home/werner/.emacs.d/straight/build/w3m/"
"/home/werner/.emacs.d/straight/build/auto-package-update/"
"/home/werner/.emacs.d/straight/build/dash/"
"/home/werner/.emacs.d/straight/build/emacs-framebuffer/"
"/home/werner/.emacs.d/straight/build/undo-tree/"
"/home/werner/.emacs.d/straight/build/queue/"
"/home/werner/.emacs.d/straight/build/no-littering/"
"/home/werner/.emacs.d/straight/build/ws-butler/"
"/home/werner/.emacs.d/straight/build/drag-stuff/"
"/home/werner/.emacs.d/straight/build/hideshowvis/"
"/home/werner/.emacs.d/straight/build/iedit/"
"/home/werner/.emacs.d/straight/build/centaur-tabs/"
"/home/werner/.emacs.d/straight/build/powerline/"
"/home/werner/.emacs.d/straight/build/popwin/"
"/home/werner/.emacs.d/straight/build/repl-toggle/"
"/home/werner/.emacs.d/straight/build/fullframe/"
"/home/werner/.emacs.d/straight/build/embark/"
"/home/werner/.emacs.d/straight/build/eldoc-eval/"
"/home/werner/.emacs.d/straight/build/gnu-elpa-keyring-update/"
"/home/werner/.emacs.d/straight/build/yodel/"
"/home/werner/.emacs.d/straight/build/use-package/"
"/home/werner/.emacs.d/straight/build/bind-key/"
"/home/werner/.emacs.d/straight/build/straight/"
"/usr/local/share/info" "/opt/texlive/2021/texmf-dist/doc/info"
"/usr/local/share/info/" "/usr/share/info/" "/usr/local/share/info/")

Set

Documentation
List of directories to search for Info documentation files.

If nil, meaning not yet initialized, Info uses the environment
variable INFOPATH to initialize it, or Info-default-directory-list
if there is no INFOPATH variable in the environment, or the
concatenation of the two if INFOPATH ends with a path-separator.

When Info-directory-list is initialized from the value of
Info-default-directory-list, and Emacs is installed in one of the
standard directories, the directory of Info files that come with Emacs
is put last (so that local Info files override standard ones).

When Info-directory-list is initialized from the value of
Info-default-directory-list, and Emacs is not installed in one
of the standard directories, the first element of the resulting
list is the directory where Emacs installs the Info files that
come with it.  This is so that Emacs's own manual, which suits the
version of Emacs you are using, will always be found first.  This
is useful when you install an experimental version of Emacs without
removing the standard installation.

If you want to override the order of directories in
Info-default-directory-list, set INFOPATH in the environment.

If you run the Emacs executable from the src directory in the Emacs
source tree, and INFOPATH is not defined, the info directory in the
source tree is used as the first element of Info-directory-list, in
place of the installation Info directory.  This is useful when you run
a version of Emacs without installing it.

References
References in info.el.gz:
(defvar Info-directory-list ...)  1 reference
(defun info-initialize ...)       3 references
(defun Info-find-file ...)        2 references
(defun Info-insert-dir ...)       2 references
(defun Info-read-node-name-1 ...) 1 reference
(defun info--manual-names ...)    1 reference

Find all references

Debugging
Forget

Source Code
;; Defined in /usr/local/share/emacs/29.0.50/lisp/info.el.gz
(defvar Info-directory-list nil
  "List of directories to search for Info documentation files.
If nil, meaning not yet initialized, Info uses the environment
variable INFOPATH to initialize it, or `Info-default-directory-list'
if there is no INFOPATH variable in the environment, or the
concatenation of the two if INFOPATH ends with a `path-separator'.

When `Info-directory-list' is initialized from the value of
`Info-default-directory-list', and Emacs is installed in one of the
standard directories, the directory of Info files that come with Emacs
is put last (so that local Info files override standard ones).

When `Info-directory-list' is initialized from the value of
`Info-default-directory-list', and Emacs is not installed in one
of the standard directories, the first element of the resulting
list is the directory where Emacs installs the Info files that
come with it.  This is so that Emacs's own manual, which suits the
version of Emacs you are using, will always be found first.  This
is useful when you install an experimental version of Emacs without
removing the standard installation.

If you want to override the order of directories in
`Info-default-directory-list', set INFOPATH in the environment.

If you run the Emacs executable from the `src' directory in the Emacs
source tree, and INFOPATH is not defined, the `info' directory in the
source tree is used as the first element of `Info-directory-list', in
place of the installation Info directory.  This is useful when you run
a version of Emacs without installing it.")

Symbol Properties
variable-documentation
  ("/usr/local/share/emacs/29.0.50/lisp/info.elc" . 5987)
```
When I try to run `swiper` on the above variable's buffer, I found
that it takes a very long time, about 10 seconds, before the search
window of `swiper` appears. Then I try to profile it as follows:

```
M-x profile-start
C-h v Info-directory-list RET
C-s
# Wait until the `swiper` search window appears:
C-g
M-x profile-report
```

Finally, I got the following profiling results:

```
       16568  99% - command-execute
       16568  99%  - call-interactively
       16568  99%   - funcall-interactively
       15717  94%    - swiper
       15453  92%     - swiper--candidates
        7836  46%      - swiper--line
        3924  23%         end-of-visual-line
        3912  23%         beginning-of-visual-line
        7617  45%      - #<compiled -0x19327c606ee3e5ae>
        7617  45%       - line-move
        5802  34%        - line-move-visual
           8   0%         - posn-at-point
           8   0%          - eval
           4   0%             mode-line-eol-desc
           4   0%             if
         232   1%     - ivy-read
         225   1%      - read-from-minibuffer
         116   0%       - ivy--queue-exhibit
         116   0%        - ivy--exhibit
         116   0%         + ivy--insert-minibuffer
          13   0%       + timer-event-handler
           4   0%       + redisplay_internal (C function)
           3   0%      + ivy--reset-state
          28   0%       beginning-of-visual-line
           4   0%       count-screen-lines
         851   5%    + counsel-M-x
          79   0% - ...
          79   0%    Automatic GC
          31   0% - redisplay_internal (C function)
          19   0%  - menu-bar-update-buffers
          19   0%     menu-bar-buffer-vector
           8   0%  - eval
           4   0%   - unless
           4   0%    - if
           4   0%       display-graphic-p
           4   0%  - funcall
           4   0%   - #<compiled -0x182f85a9c5149f67>
           4   0%    - gui-backend-selection-exists-p
           4   0%     - apply
           4   0%        #<compiled -0x4747a016696a429>
```
Any hints for this problem?

Regards,
HZ



reply via email to

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