-
Notifications
You must be signed in to change notification settings - Fork 151
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
It's slower than package.el #9
Comments
I think it got slower after the recent refactor. :'( |
Can confirm - it's around 1-2 seconds slower for me. (My init time went from 2.5-ish seconds to 4.2-ish) ...would this have anything to do with the fact that emacs has to follow symlinks? EDIT: Scratch that, seems like my config has gotten slower for other reasons besides this, it's only really like .1-.3 seconds slower |
It's great to hear that it's not actually that much slower. My config has also gotten slower for other reasons that I haven't bothered to fix yet, so I haven't done profiling on See also #41, which should eliminate even the 100–300ms slowdown. By the way, how many packages do you have? (You can get that number by evaluating |
I'm pretty sure the symlinks are negligible. The slowdown should be almost entirely due to the fact that |
I have 173 packages, apparently. (Huh, I should probably revise this and get rid of the cruft) I |
I believe that you are not in fact imagining things, and I'm finally going to get my Emacs config back to a <0.5s init, so I'm investigating this issue now. |
Some profiling.
|
So is pretty printing necessary? Or what's the advantage of it? Nice work btw 🎉 |
Pretty-printing is nice since (1) you can read the build cache and (2) Emacs can edit it without choking on it being a single long line. But the delay is too high a cost to pay, so pretty-printing is disabled now (once I push my performance-improving commits). |
Ah it's a shame emacs chokes on it, I was thinking if anyone needs to read it, they can just pretty print it interactively from emacs. I'm not sure what the solution to that is then. 😕 |
Maybe there could be a configuration option for it. |
Emacs can perfectly well read and write it. It's just that if you try to edit the file interactively, there will be a fair bit of lag. And you're right that inspection of the value can also happen from within Emacs ( |
Alright. I've eliminated all the duplicate work being done (e.g #117), and improved performance in a number of other situations (e.g. evaluating a single file of However, performance improvements are not as significant as I would like. Further profiling reveals the following remaining bottlenecks on my config of ~108 packages:
|
Just ported to straight.el and wanted to chime in on this issue - my config lives on spinning rust, so the first time I open emacs after booting, it takes 50 (fifty, five zero) seconds of continuous disk io to spawn a window. Subsequent loads are snappy (sub-1s) because my config is relatively small, but that first invocation of |
@tummychow How many packages do you have?
I have 126, and my |
Here's my lockfile. Running that snippet of elisp shows 26 packages. This is Arch Linux, GNU findutils 4.6.0, emacs 25.3.1. The config lives on a WDC WD10SPCX-60K (5400rpm laptop-size spinning rust). Any debugging you'd like me to try? |
@tummychow Try evaluating the following:
That should give you just the time of the What I just noticed is that your init-file is loaded by org-tangle. This might mean that your configuration code is loaded after It might be a good idea to add a warning in the case that |
My init is in orgmode, but I tangle the file every time I save, not when emacs starts up. My init.el is exactly the contents of the org-src blocks. That snippet executes in <0.1s, but the disk is already warmed up at this point. Similarly, if I |
The easiest way would probably just be to edit |
Bingo:
First run was immediately after booting, second run was immediately after that. Full contents of the find invocation here. |
That's impressive. I had no idea how pronounced the difference was for a non-SSD. In any case, I think the only solution is #41. |
IMHO |
@Compro-Prasad Because I would like to present More generally, |
@raxod502 What about using |
Are you suggesting that this would improve performance? If so, why do you think so? |
I don't know. Not an elisp expert. Just saw that |
|
Hey, not sure if this is useful at all, but I'm moving to
I'm on macOS Mojave with a 3.1GHz i7, 16GB ram, and an SSD. |
@OldhamMade If you're using the default modification checking, then you'll see a large amount of time spent on whatever |
Just ported to straight.el and run esup. packaging.el:23 1.069sec 62%
(load-file (expand-file-name "straight.el" user-site-lisp-dir)) 62% of time Emacs spent for loading straight.el. I have 119 package, and my 1.069sec for loading straight.el using NVMe M.2 SSD |
@sergeyklay Something seems fishy there. Loading You should also check the value of |
Actually my ;;; straight.el --- straight.el installer. -*- lexical-binding: t; -*-
;;; Commentary:
;; This library simply installs straight.el.
;; No further configuration is done.
;;; Code:
(unless (featurep 'straight)
(defvar bootstrap-version)
(let ((bootstrap-file (concat user-emacs-directory
"straight/repos/straight.el/bootstrap.el"))
(bootstrap-version 5))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage)))
;; Local Variables:
;; flycheck-disabled-checkers: (emacs-lisp-checkdoc)
;; End:
;;; straight.el ends here |
Counterpoint: I have 157 packages (most of them are lazy loaded) and emacs takes 0.35s to start with scratch buffer. esup shows this code as most time consuming in straight.el:
I use emacs 27 and everything is on SSD. |
@wedens How much does Emacs spend loading a bootstrap file? |
@sergeyklay code you mentioned above takes 0.03sec (with already downloaded bootstrap.el) |
@wedens What exactly do you mean saying "most of them are lazy loaded". Could you please provide some typical examples? |
@sergeyklay I use use-package with Another popular startup time optimization is to increase You may want to try (or at least looks at its code) doom-emacs which uses straight.el and does a lot optimizations (including mentioned above) to achieve fast startup. But all this is not really specific to straight.el. |
@wedens Yes, you're right all of this is not really specific to
(setq-default straight-vc-git-default-clone-depth 1)
(load-file (expand-file-name "straight.el" user-site-lisp-dir))
;; Install use-package using straight.el
(straight-use-package 'use-package)
;; Use straight.el by default in use-package directives
(setq straight-use-package-by-default t) that's all |
@sergeyklay What emacs version do you use? emacs 27 starts noticeable faster. You can try installing watchexec and setting |
Could straight.el profit from the new |
Not directly. You can improve Emacs startup by moving all graphical frame customizations into |
My startup time was 0.5s before using
straight.el
; now it's 0.9s.The text was updated successfully, but these errors were encountered: