emacs-diffs
[Top][All Lists]
Advanced

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

master eeade2b: * lisp/emacs-lisp/package.el: Byte compile the quickstar


From: Stefan Monnier
Subject: master eeade2b: * lisp/emacs-lisp/package.el: Byte compile the quickstart file
Date: Fri, 18 Dec 2020 10:02:20 -0500 (EST)

branch: master
commit eeade2b64767bfce9118eae36c25363a7fb6ea76
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    * lisp/emacs-lisp/package.el: Byte compile the quickstart file
    
    Earlier tests had found problems when byte-compiling the file,
    but later investigations indicated the problem was not
    directly related.  The performance difference is appreciable.
    
    (package-quickstart-refresh): Byte compile the file.
    (package-activate-all): Load byte-compiled version if available.
    (package--quickstart-maybe-refresh): Delete the byte-compiled file as well.
---
 lisp/emacs-lisp/package.el | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index b7c48df..f6ad6d2 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1615,18 +1615,22 @@ that code in the early init-file."
   "Activate all installed packages.
 The variable `package-load-list' controls which packages to load."
   (setq package--activated t)
-  (if (file-readable-p package-quickstart-file)
-      ;; Skip load-source-file-function which would slow us down by a factor
-      ;; 2 (this assumes we were careful to save this file so it doesn't need
-      ;; any decoding).
-      (let ((load-source-file-function nil))
-        (load package-quickstart-file nil 'nomessage))
-    (dolist (elt (package--alist))
-      (condition-case err
-          (package-activate (car elt))
-        ;; Don't let failure of activation of a package arbitrarily stop
-        ;; activation of further packages.
-        (error (message "%s" (error-message-string err)))))))
+  (let* ((elc (concat package-quickstart-file "c"))
+         (qs (if (file-readable-p elc) elc
+               (if (file-readable-p package-quickstart-file)
+                   package-quickstart-file))))
+    (if qs
+        ;; Skip load-source-file-function which would slow us down by a factor
+        ;; 2 when loading the .el file (this assumes we were careful to
+        ;; save this file so it doesn't need any decoding).
+        (let ((load-source-file-function nil))
+          (load qs nil 'nomessage))
+      (dolist (elt (package--alist))
+        (condition-case err
+            (package-activate (car elt))
+          ;; Don't let failure of activation of a package arbitrarily stop
+          ;; activation of further packages.
+          (error (message "%s" (error-message-string err))))))))
 
 ;;;; Populating `package-archive-contents' from archives
 ;; This subsection populates the variables listed above from the
@@ -4041,6 +4045,7 @@ activations need to be changed, such as when 
`package-load-list' is modified."
       ;; FIXME: Delay refresh in case we're installing/deleting
       ;; several packages!
       (package-quickstart-refresh)
+    (delete-file (concat package-quickstart-file "c"))
     (delete-file package-quickstart-file)))
 
 (defun package-quickstart-refresh ()
@@ -4098,7 +4103,8 @@ activations need to be changed, such as when 
`package-load-list' is modified."
 ;;\sno-byte-compile: t
 ;; no-update-autoloads: t
 ;; End:
-"))))
+"))
+    (byte-compile-file package-quickstart-file)))
 
 (defun package--imenu-prev-index-position-function ()
   "Move point to previous line in package-menu buffer.



reply via email to

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