Subject: bug#15112: 24.3; package.el byte compile autoloads

From: Stefan Kangas <[email-masked]>
Date: Thu, 26 Nov 2020 05:18:36 -0500

Hi Michael,

Michael Albinus <[email-masked]> writes:

>> I made a little experiment and of course byte-compiling these files
>> gives us a ton of headaches, see below.  So I'm not sure this is all
>> worth it.  Do we have reason to believe that byte-compiling these files
>> would give any significant performance increase?
>>
>>   ELC      net/tramp-loaddefs.elc
>
> I don't know which kind of experiment you have applied, so I cannot say
> anything about the compilation errors. However, I wonder where paths
> like "net/tramp-loaddefs.elc" come from. We're speaking about
> package.el, meaning we're speaking about ELPA. Tramp in ELPA doesn't use
> any subdirectory "net".

I used this patch:

diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el
index 07bda537b3..e32d74fa7c 100644
--- a/lisp/emacs-lisp/autoload.el
+++ b/lisp/emacs-lisp/autoload.el
@@ -373,7 +373,7 @@ autoload-rubric
 	    ";;; Code:\n\n"
 	    (if lp
 		"(add-to-list 'load-path (directory-file-name
-                         (or (file-name-directory #$) (car load-path))))\n\n")
+                         (or (file-name-directory load-file-name)
(car load-path))))\n\n")
 	    "\n"
 	    ;; This is used outside of autoload.el, eg cus-dep, finder.
 	    (if feature
@@ -382,7 +382,6 @@ autoload-rubric
 			  (file-name-sans-extension basename))))
 	    ";; Local Variables:\n"
 	    ";; version-control: never\n"
-            ";; no-byte-compile: t\n" ;; #$ is byte-compiled into nil.
 	    ";; no-update-autoloads: t\n"
 	    ";; coding: utf-8\n"
 	    ";; End:\n"

And ran "make bootstrap".

> Anyway, I don't believe we'll see a performance boost after
> byte-compiling loaddef files. They just contain function and variable
> declarations, no implementation (but the initial values of variables).
>
> There are exceptions like in tramp-loaddefs.el, but they still don't
> count wrt performance, I believe.

This would be my guess too.  It seems like more trouble than it's worth.