From mboxrd@z Thu Jan 1 00:00:00 1970 From: taylanbayirli@gmail.com (Taylan Ulrich =?utf-8?Q?Bay=C4=B1rl=C4=B1?= =?utf-8?Q?=2FKammer?=) Subject: Re: Building Guix with Guile 2.1 Date: Thu, 22 Sep 2016 22:45:30 +0200 Message-ID: <87r38boe8l.fsf@T420.taylan> References: <87fuotl367.fsf@gnu.org> <87vaxpnf11.fsf@T420.taylan> <87k2e4e1ay.fsf@igalia.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38908) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bnAtD-0006PI-HV for guix-devel@gnu.org; Thu, 22 Sep 2016 16:46:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bnAt9-0004WL-SG for guix-devel@gnu.org; Thu, 22 Sep 2016 16:46:38 -0400 In-Reply-To: <87k2e4e1ay.fsf@igalia.com> (Andy Wingo's message of "Thu, 22 Sep 2016 11:22:45 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Andy Wingo Cc: guix-devel Andy Wingo writes: > On Wed 21 Sep 2016 23:01, taylanbayirli@gmail.com (Taylan Ulrich "Bay=C4= =B1rl=C4=B1/Kammer") writes: > >> By the way, compile time seems to increase greatly with 2.2, to the >> point I wondered if it's really compiling in parallel, but it does seem >> to as evidenced by top(1). Maybe package modules could be compiled with >> certain optims turned off, since they mostly just consist of package >> object definitions and not procedures whose performance would matter. > > How much? Running make, then make clean-go, then 'time make', we get: Guile 2.0: real 2m46.405s user 6m39.044s sys 0m2.140s Guile 2.2: real 31m44.433s user 84m32.060s sys 0m10.880s Does that look too extreme? Maybe there's another issue. > I think turning off most optimizations for the packages is a good idea. > There is not a nice way to do this however. What `guild compile -O1 > ...` does is: > > http://git.savannah.gnu.org/gitweb/?p=3Dguile.git;a=3Dblob;f=3Dmodule/s= cripts/compile.scm;h=3D939fb2564ec344de5f4a531b2041383730262d4f;hb=3DHEAD#l= 55 > > The default is -O2. Thanks for the pointer. I tried incorporating that the following way; tell me if there's a mistake: (The middle hunk is unaltered code copied from scripts/compile.scm.) --- snip --- @@ -19,6 +19,8 @@ =20 (use-modules (system base target) (system base message) + (language tree-il optimize) + (language cps optimize) (ice-9 match) (ice-9 threads) (guix build utils)) @@ -63,6 +65,19 @@ (format #t " LOAD ~a~%" module) (resolve-interface module))) =20 +(define (available-optimizations) + (append (tree-il-default-optimization-options) + (cps-default-optimization-options))) + +(define (optimizations-for-level level) + (let lp ((options (available-optimizations))) + (match options + (() '()) + ((#:partial-eval? val . options) + (cons* #:partial-eval? (> level 0) (lp options))) + ((kw val . options) + (cons* kw (> level 1) (lp options)))))) + (define (compile-file* file output-mutex) (let ((go (scm->go file))) (with-mutex output-mutex @@ -74,7 +89,8 @@ (lambda () (compile-file file #:output-file go - #:opts `(#:warnings ,warnings))))))) + #:opts `(#:warnings ,warnings + @,(optimizations-for-level 1)))))))) =20 (match (command-line) ((_ . files) --- snip --- Using optim level 1, compilation takes the same amount of time *and* I get a segfault at the end. When re-running make, it finishes by compiling only gnu/packages/python.go (indicating that all other .go files were compiled successfully on the first run), and this time succeeds without a segfault. Using optim level 0, it seems to hang at gnu/packages/shells.go. (More precisely, I aborted after a total of 118 minutes, most of which was spent waiting for shells.go to finish.) So much for today; I'll see that I get a backtrace from the segfault later. Taylan