From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Speeding up the bootstrap build - a quick hack. Date: Tue, 18 Jan 2022 11:56:38 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32904"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jan 18 12:58:07 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n9n7n-0008Mt-Kp for ged-emacs-devel@m.gmane-mx.org; Tue, 18 Jan 2022 12:58:07 +0100 Original-Received: from localhost ([::1]:48526 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n9n7m-0002km-Nu for ged-emacs-devel@m.gmane-mx.org; Tue, 18 Jan 2022 06:58:06 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:50006) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n9n6a-0001M3-M8 for emacs-devel@gnu.org; Tue, 18 Jan 2022 06:56:52 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:19637 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.90_1) (envelope-from ) id 1n9n6Y-0004nm-DA for emacs-devel@gnu.org; Tue, 18 Jan 2022 06:56:52 -0500 Original-Received: (qmail 8777 invoked by uid 3782); 18 Jan 2022 11:56:39 -0000 Original-Received: from acm.muc.de (p4fe158ed.dip0.t-ipconnect.de [79.225.88.237]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 18 Jan 2022 12:56:38 +0100 Original-Received: (qmail 20878 invoked by uid 1000); 18 Jan 2022 11:56:38 -0000 Content-Disposition: inline In-Reply-To: X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de Received-SPF: pass client-ip=193.149.48.1; envelope-from=acm@muc.de; helo=mail.muc.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:284918 Archived-At: 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 $ 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 $ Stefan -- Alan Mackenzie (Nuremberg, Germany).