all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Speeding up the bootstrap build - a quick hack.
Date: Tue, 18 Jan 2022 11:56:38 +0000	[thread overview]
Message-ID: <Yeaq9mCUrG3ekRvk@ACM> (raw)
In-Reply-To: <jwvpmoqcco3.fsf-monnier+emacs@gnu.org>

Hello, Stefan.

Thanks for the detailled feedback.

On Mon, Jan 17, 2022 at 15:55:26 -0500, Stefan Monnier wrote:
> > The following may go some way to fixing this slowdown.  Its idea is to
> > build the lisp directory first by compiling the byte compiler and then
> > using this to build the native compiler, rather than building the native
> > compiler directly from interpreted list.

> Thanks, that's pretty much what I suggested we should do (tho I wasn't
> too sure *how* to do that ;-)

:-)

> > This patch is at the stage of being a crude hack, and it has been tried
> > only on GNU.  It might work on other systems, though.

> It looks pretty good and clean, actually.

Oh, thanks!

> I of course have some comments/questions:

> > +COMPILE_ZEROTH = \
> > +	$(lisp)/emacs-lisp/macroexp.elc0 \
> > +	$(lisp)/emacs-lisp/cconv.elc0 \
> > +	$(lisp)/emacs-lisp/byte-opt.elc0 \
> > +	$(lisp)/emacs-lisp/bytecomp.elc0 \
> > +	$(lisp)/emacs-lisp/comp-cstr.elc0 \
> > +	$(lisp)/emacs-lisp/comp.elc0
> > +
> >  COMPILE_FIRST = \
> >  	$(lisp)/emacs-lisp/macroexp.elc \
> >  	$(lisp)/emacs-lisp/cconv.elc    \

> Can't COMPILE_ZEROTH be made directly from COMPILE_FIRST so we don't
> need to maintain two different lists?

It can, yes.  There's no reason for them to be different files at the
moment, so I've done this.

> >  # An old-fashioned suffix rule, which, according to the GNU Make manual,
> >  # cannot have prerequisites.
> >  ifeq ($(HAVE_NATIVE_COMP),yes)
> > -.el.elc:
> > +.el.elc0:
> > +	$(AM_V_ELC)$(emacs) $(BYTE_COMPILE_FLAGS) \
> > +	--exec "(setq load-suffixes '(\".elc0\" \".el\"))" \
> > +	-f batch-byte-compile $<
> > +	mv $<c $@

> The indentation looks wrong here, tho maybe it's a question of taste
> (or it's a problem in the TAB/SPC transfer through email).

I think it's just the TAB going to column 8 whatever.

> > +%.elc : %.el $(COMPILE_ZEROTH)
> >  	$(AM_V_ELC)$(emacs) $(BYTE_COMPILE_FLAGS) \
> > +	--exec "(setq load-suffixes '(\".elc0\" \".elc\" \".el\"))" \
> >  	-l comp -f batch-byte+native-compile $<

> Shouldn't this list have `.elc` before `.elc0` so we use the
> native-compiled compiler when available?

I think so, yes.  I've changed this now.

> > -.PHONY: compile-first compile-main compile compile-always
> > +.PHONY: compile-zeroth compile-first compile-main compile compile-always

> > -compile-first: $(COMPILE_FIRST)
> > +compile-zeroth: $(COMPILE_ZEROTH)
> > +compile-first: compile-zeroth $(COMPILE_FIRST)

> Is this necessary, or is it just helpful to debug the Makefile?

I'm not sure.  I'm a little confused, still.

Could I ask you to give the latest version, below, a quick eyeballing,
please?  Maybe I could install this.



diff --git a/lisp/Makefile.in b/lisp/Makefile.in
index 3a72034463..7df58af05e 100644
--- a/lisp/Makefile.in
+++ b/lisp/Makefile.in
@@ -96,6 +96,10 @@ COMPILE_FIRST +=
 endif
 COMPILE_FIRST += $(lisp)/emacs-lisp/autoload.elc
 
+ifeq ($(HAVE_NATIVE_COMP),yes)
+COMPILE_ZEROTH = $(COMPILE_FIRST:.elc=.elc0)
+endif
+
 # Files to compile early in compile-main.  Works around bug#25556.
 MAIN_FIRST = ./emacs-lisp/eieio.el ./emacs-lisp/eieio-base.el \
   ./cedet/semantic/db.el ./emacs-lisp/cconv.el
@@ -298,22 +302,30 @@ $(THEFILE)n:
 # subdirectories, to make sure require's and load's in the files being
 # compiled find the right files.
 
-.SUFFIXES: .elc .el
+.SUFFIXES: .elc0 .elc .el
 
 # An old-fashioned suffix rule, which, according to the GNU Make manual,
 # cannot have prerequisites.
 ifeq ($(HAVE_NATIVE_COMP),yes)
-.el.elc:
+.el.elc0:
+	$(AM_V_ELC0)$(emacs) $(BYTE_COMPILE_FLAGS) \
+	--exec "(setq load-suffixes '(\".elc0\" \".el\"))" \
+	-f batch-byte-compile $<
+	mv $<c $@
+
+%.elc: %.el $(COMPILE_ZEROTH)
 	$(AM_V_ELC)$(emacs) $(BYTE_COMPILE_FLAGS) \
+	--exec "(setq load-suffixes '(\".elc\" \".elc0\" \".el\"))" \
 	-l comp -f batch-byte+native-compile $<
 else
 .el.elc:
 	$(AM_V_ELC)$(emacs) $(BYTE_COMPILE_FLAGS) -f batch-byte-compile $<
 endif
 
-.PHONY: compile-first compile-main compile compile-always
+.PHONY: compile-zeroth compile-first compile-main compile compile-always
 
-compile-first: $(COMPILE_FIRST)
+compile-zeroth: $(COMPILE_ZEROTH)
+compile-first: compile-zeroth $(COMPILE_FIRST)
 
 # In 'compile-main' we could directly do
 #    ... | xargs $(MAKE)
@@ -492,7 +504,7 @@ $(CAL_DIR)/hol-loaddefs.el:
 .PHONY: bootstrap-clean distclean maintainer-clean
 
 bootstrap-clean:
-	find $(lisp) -name '*.elc' $(FIND_DELETE)
+	find $(lisp) \( -name '*.elc' -o -name '*.elc0' \) $(FIND_DELETE)
 	rm -f $(AUTOGENEL)
 
 distclean:
diff --git a/src/verbose.mk.in b/src/verbose.mk.in
index e3f5678303..a8081ee55a 100644
--- a/src/verbose.mk.in
+++ b/src/verbose.mk.in
@@ -26,6 +26,7 @@ AM_V_CC =
 AM_V_CXX =
 AM_V_CCLD =
 AM_V_CXXLD =
+AM_V_ELC0 =
 AM_V_ELC =
 AM_V_ELN =
 AM_V_GEN =
@@ -41,13 +42,16 @@ AM_V_CCLD    = @$(info $   CCLD     $@)
 AM_V_CXXLD   = @$(info $   CXXLD    $@)
 ifeq ($(HAVE_NATIVE_COMP),yes)
 ifeq ($(NATIVE_DISABLED),1)
+AM_V_ELC0    = @$(info $   ELC0     $@)
 AM_V_ELC     = @$(info $   ELC      $@)
 AM_V_ELN =
 else
+AM_V_ELC0    = @$(info $   ELC0     $@)
 AM_V_ELC     = @$(info $   ELC+ELN  $@)
 AM_V_ELN     = @$(info $   ELN      $@)
 endif
 else
+AM_V_ELC0 =
 AM_V_ELC     = @$(info $   ELC      $@)
 AM_V_ELN =
 endif


>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).



  reply	other threads:[~2022-01-18 11:56 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-17 20:26 Speeding up the bootstrap build - a quick hack Alan Mackenzie
2022-01-17 20:55 ` Stefan Monnier
2022-01-18 11:56   ` Alan Mackenzie [this message]
2022-01-18 13:14     ` Stefan Monnier
2022-01-18 20:27       ` Alan Mackenzie
2022-01-18 20:48         ` Stefan Monnier
2022-01-19 11:50           ` Alan Mackenzie
2022-01-19 14:34             ` Stefan Monnier
2022-01-19 15:24               ` Stefan Monnier
2022-01-18 13:16     ` Robert Pluim
2022-01-18 14:04       ` Alan Mackenzie
2022-01-18 14:13         ` Robert Pluim
2022-01-18 14:24           ` Stefan Monnier
2022-01-18 14:35             ` Robert Pluim
2022-01-18 15:13               ` Robert Pluim
2022-01-18 16:50                 ` Eli Zaretskii
2022-01-18 16:09               ` Andrea Corallo
2022-01-18 18:36               ` Stefan Monnier
2022-01-18 14:05       ` Stefan Monnier
2022-01-18 14:18         ` Robert Pluim
2022-01-17 21:03 ` Lars Ingebrigtsen
2022-01-18  0:46 ` Po Lu
2022-01-18 14:17 ` Eli Zaretskii
2022-01-18 18:40   ` Stefan Monnier
2022-01-18 19:34     ` Eli Zaretskii
2022-01-18 20:28       ` Stefan Monnier
2022-01-18 20:35       ` Alan Mackenzie
2022-01-18 20:50         ` Stefan Monnier
2022-01-19 11:10       ` Alan Mackenzie
2022-01-19 11:46         ` Eli Zaretskii
2022-01-19 16:50           ` Alan Mackenzie
2022-01-19 17:03             ` Eli Zaretskii
2022-01-19 21:32               ` Alan Mackenzie
2022-01-20  9:25                 ` Robert Pluim
2022-01-20 11:35                   ` Alan Mackenzie
2022-01-20 13:18                     ` Robert Pluim
2022-01-20 14:54                       ` Robert Pluim
2022-01-20 18:48                         ` Alan Mackenzie
2022-01-20 22:29                           ` Stefan Monnier
2022-01-21  8:17                             ` Robert Pluim
2022-01-21 10:18                 ` Stephen Leake
2022-01-21 10:42                   ` David Engster
2022-01-21 10:51                   ` Robert Pluim
2022-01-24 19:43 ` Andrea Corallo
2022-01-24 19:54   ` Eli Zaretskii
2022-01-24 20:15     ` Andrea Corallo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yeaq9mCUrG3ekRvk@ACM \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.