unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* 28.0.50; Proposal: slightly more efficient package-quickstart.el
@ 2021-07-20  0:27 Arthur Miller
  2021-07-20  2:54 ` Stefan Monnier
  0 siblings, 1 reply; 43+ messages in thread
From: Arthur Miller @ 2021-07-20  0:27 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1006 bytes --]


The puropose of "quickstart" file is to perform some calculations
offline to speed up startup time, and what I see in generated code that
every package is added to load-path with `add-to-list' function, which
will ensure that each object is added only once.

Since quickstart file is created by iterating through each and one
installed package whose path is already known, this calculation can be
performed once at generation time, rather than every time when Emacs
starts. It is relatively simple to alter the generator routine for this,
I have included patch. I have been doing something similar in my
personal init file since quite some time now and have not had problems,
but I am not that sofisticated user.

I guess this won't speed thing much, maybe people who use large number
of packages could see some difference. Regardless it is still an
unnecessary computation and thus waste of cpu (and battery) to do this
every startup if it can be done only once when package-quickstart.el is
generated.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: package.patch --]
[-- Type: text/x-patch, Size: 1887 bytes --]

--- ../emacs/lisp/emacs-lisp/package.el	2021-07-11 12:20:59.257657537 +0200
+++ ./package.el	2021-07-20 02:01:38.050169037 +0200
@@ -4137,7 +4137,8 @@
         (package-activated-list ())
         ;; Make sure we can load this file without load-source-file-function.
         (coding-system-for-write 'emacs-internal)
-        (Info-directory-list '("")))
+        (Info-directory-list '(""))
+        paths)
     (dolist (elt package-alist)
       (condition-case err
           (package-activate (car elt))
@@ -4155,6 +4156,7 @@
                 (let ((load-suffixes '(".el" ".elc")))
                   (locate-library (package--autoloads-file-name pkg))))
                (pfile (prin1-to-string file)))
+          (push (package-desc-dir pkg) paths)
           (insert "(let ((load-true-file-name " pfile ")\
 (load-file-name " pfile "))\n")
           (insert-file-contents file)
@@ -4164,6 +4166,10 @@
               (replace-match (if (match-end 1) "" pfile) t t)))
           (unless (bolp) (insert "\n"))
           (insert ")\n")))
+      (goto-char (point-min))
+      (while (re-search-forward "^(add-to-list.*load-path" nil t)
+        (goto-char (line-beginning-position))
+        (kill-sexp))
       (pp `(setq package-activated-list
                  (append ',(mapcar #'package-desc-name package--quickstart-pkgs)
                          package-activated-list))
@@ -4175,6 +4181,10 @@
                       (setq Info-directory-list
                             (append ',info-dirs Info-directory-list)))
               (current-buffer))))
+      (goto-char (point-min))
+      (forward-line 3)
+      (insert (concat "\n(nconc load-path '" (prin1-to-string paths) ")\n"))
+      (goto-char (point-max))
       ;; Use `\s' instead of a space character, so this code chunk is not
       ;; mistaken for an actual file-local section of package.el.
       (insert "\f

^ permalink raw reply	[flat|nested] 43+ messages in thread

end of thread, other threads:[~2021-08-07  5:45 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-20  0:27 28.0.50; Proposal: slightly more efficient package-quickstart.el Arthur Miller
2021-07-20  2:54 ` Stefan Monnier
2021-07-20  6:01   ` Arthur Miller
2021-07-20 15:49     ` Stefan Monnier
2021-07-22 22:38       ` Arthur Miller
2021-07-23 14:36         ` Stefan Monnier
2021-07-23 14:50           ` Async rebuild package-quickstart after packages update? was " T.V Raman
2021-08-03 22:20             ` Stefan Monnier
2021-08-04  2:24               ` T.V Raman
2021-08-04  3:25                 ` Stefan Monnier
2021-08-04 14:20                   ` T.V Raman
2021-08-04 17:19                     ` Stefan Monnier
2021-08-04 18:36                       ` T.V Raman
2021-08-05  0:22                       ` T.V Raman
2021-08-05  6:00                         ` Eli Zaretskii
2021-08-05 14:17                           ` T.V Raman
2021-08-05 14:29                           ` T.V Raman
2021-08-05 14:59                             ` Stefan Monnier
2021-08-05 15:21                               ` T.V Raman
2021-08-05 16:23                                 ` Stefan Monnier
2021-08-06  5:18                                   ` Arthur Miller
2021-08-06  6:39                                     ` Eli Zaretskii
2021-08-06 13:20                                       ` Arthur Miller
2021-08-06 13:28                                         ` Eli Zaretskii
2021-08-06 14:13                                           ` Arthur Miller
2021-08-06 14:53                                           ` Arthur Miller
2021-08-07  0:46                                             ` chad
2021-08-07  5:26                                               ` Eli Zaretskii
2021-08-07  5:45                                               ` Arthur Miller
2021-08-06 14:24                                       ` Stefan Monnier
2021-08-06 14:29                                         ` T.V Raman
2021-08-05 16:25                                 ` Eli Zaretskii
2021-08-05 16:57                                   ` T.V Raman
2021-08-05 17:03                                     ` Eli Zaretskii
2021-08-05 18:11                                     ` Stefan Monnier
2021-08-05 18:23                                       ` T.V Raman
2021-08-05 19:48                                       ` On The Use(fullness) of make-thread " T.V Raman
2021-08-06  5:24                                       ` Arthur Miller
2021-08-07  4:19                                       ` Clément Pit-Claudel
2021-08-07  5:38                                         ` Arthur Miller
2021-07-23 17:00           ` Arthur Miller
2021-07-23 22:26       ` Arthur Miller
2021-07-23 22:37         ` Arthur Miller

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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