Andy Wingo <> writes:

> On Wed 21 Sep 2016 23:01, (Taylan Ulrich 
> "Bayırlı/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:
> 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 @@
 (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)))
+(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))))))))
 (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


Reply via email to