Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Startup speed #3019

Open
yanchith opened this issue Jun 29, 2023 · 0 comments
Open

Startup speed #3019

yanchith opened this issue Jun 29, 2023 · 0 comments

Comments

@yanchith
Copy link

yanchith commented Jun 29, 2023

Hi! Before I get to the issue at hand, I really want to thank everyone working on ivy for their work. swiper and counsel-rg were two of the three "killer apps" that made me switch from VS Code to Emacs in 2018 ❤️ The third one is magit.

Sorry, if this has been reported before, I didn't find any issue describing this.

I recently tried the vertico ecosystem, and while I almost immediately switched back to ivy for usability reasons, I did find its startup speed much better.

Including ivy in my config slows the emacs-init-time by about 40-50ms, depending on the computer.

This is the tabulated and tree output of benchmark-init:

  default                                                           load         14      14
  ivy                                                               require      14      43
  ivy-faces                                                         require      12      12
  whitespace                                                        require      10      10
  ring                                                              require       9       9
  abu-theme                                                         require       6       6
  color                                                             require       5       5
  finder-inf                                                        require       4       4
  ivy-overlay                                                       require       2       2
  ~/.emacs.d/lisp/abu-theme                                         load          1       1
  colir                                                             require       1       6
╼►[benchmark-init/root nil 78ms]
  ├─[default load 14ms]
  ├─[~/.emacs.d/lisp/abu-theme load 1ms]
  ├─[abu-theme require 6ms]
  ├─[ivy require 14ms]
  │ ├─[ring require 9ms]
  │ ├─[ivy-faces require 12ms]
  │ ├─[ivy-overlay require 2ms]
  │ ╰─[colir require 1ms]
  │   ╰─[color require 5ms]
  ├─[finder-inf require 4ms]
  ╰─[whitespace require 10ms]

I could try to load ivy lazily, but that would just transfer the wait to the time I use it for the first time, which is usually right after I open Emacs. Also, I've had troubles with lazy-loading ivy before.

Is this something that can be worked on or improved?


Not sure I do anything too exotic, but here's the config:

(use-package ivy
  :straight t
  ;; TODO(yan): @Perf This costs about 40ms of startup.
  :demand t                                            ;; We pretty much need ivy the moment we start
  :bind (("C-x b"   . ivy-switch-buffer)
         ("C-x 4 b" . ivy-switch-buffer-other-window))
  :config
  (setq ivy-use-selectable-prompt t)
  (ivy-mode 1))

(use-package swiper
  :straight t
  :bind ("C-s" . swiper))

(use-package counsel
  :straight t
  :bind (("M-x"     . counsel-M-x)
         ("C-x C-f" . counsel-find-file)
         ("C-c s g" . counsel-git-grep)
         ("C-c s r" . counsel-rg)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant