gnu: Improve memoization of 'package-with-bootstrap-guile'.
Before that, the command: GUIX_PROFILING=memoization guix build -e '(@@ (gnu packages commencement) gnu-make-final)' -nd would show that 'package-with-bootstrap-guile' was called 2256 times (hit rate: 89%). Now, it is called 745 times (hit rate: 85%). "guix build libreoffice -nd" goes from 2.60s to 2.40s (-8%). * gnu/packages/commencement.scm (gnu-make-final) (coreutils-final, grep-final, sed-final, %final-inputs): Call 'package-with-bootstrap-guile' before 'package-with-explicit-inputs'.
This commit is contained in:
		
							parent
							
								
									d7e29a2b26
								
							
						
					
					
						commit
						099dbc4fd3
					
				
					 1 changed files with 27 additions and 28 deletions
				
			
		| 
						 | 
					@ -2403,18 +2403,16 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define gnu-make-final
 | 
					(define gnu-make-final
 | 
				
			||||||
  ;; The final GNU Make, which uses the final Guile.
 | 
					  ;; The final GNU Make, which uses the final Guile.
 | 
				
			||||||
  (package-with-bootstrap-guile
 | 
					  (package-with-explicit-inputs (package-with-bootstrap-guile gnu-make)
 | 
				
			||||||
   (package-with-explicit-inputs gnu-make
 | 
					 | 
				
			||||||
                                (lambda _
 | 
					                                (lambda _
 | 
				
			||||||
                                  `(("guile" ,guile-final)
 | 
					                                  `(("guile" ,guile-final)
 | 
				
			||||||
                                    ,@(%boot5-inputs)))
 | 
					                                    ,@(%boot5-inputs)))
 | 
				
			||||||
                                 (current-source-location))))
 | 
					                                (current-source-location)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define coreutils-final
 | 
					(define coreutils-final
 | 
				
			||||||
  ;; The final Coreutils.  Treat them specially because some packages, such as
 | 
					  ;; The final Coreutils.  Treat them specially because some packages, such as
 | 
				
			||||||
  ;; Findutils, keep a reference to the Coreutils they were built with.
 | 
					  ;; Findutils, keep a reference to the Coreutils they were built with.
 | 
				
			||||||
  (package-with-bootstrap-guile
 | 
					  (package-with-explicit-inputs (package-with-bootstrap-guile coreutils)
 | 
				
			||||||
   (package-with-explicit-inputs coreutils
 | 
					 | 
				
			||||||
                                %boot5-inputs
 | 
					                                %boot5-inputs
 | 
				
			||||||
                                (current-source-location)
 | 
					                                (current-source-location)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2422,15 +2420,16 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
 | 
				
			||||||
                                ;; final libc with working iconv, so that
 | 
					                                ;; final libc with working iconv, so that
 | 
				
			||||||
                                ;; 'substitute*' works well when touching
 | 
					                                ;; 'substitute*' works well when touching
 | 
				
			||||||
                                ;; test files in Gettext.
 | 
					                                ;; test files in Gettext.
 | 
				
			||||||
                                 #:guile guile-final)))
 | 
					                                #:guile guile-final))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define grep-final
 | 
					(define grep-final
 | 
				
			||||||
  ;; The final grep.  Gzip holds a reference to it (via zgrep), so it must be
 | 
					  ;; The final grep.  Gzip holds a reference to it (via zgrep), so it must be
 | 
				
			||||||
  ;; built before gzip.
 | 
					  ;; built before gzip.
 | 
				
			||||||
  (let ((grep (package-with-bootstrap-guile
 | 
					  (let ((grep (package-with-explicit-inputs
 | 
				
			||||||
               (package-with-explicit-inputs grep %boot5-inputs
 | 
					               (package-with-bootstrap-guile grep)
 | 
				
			||||||
 | 
					               %boot5-inputs
 | 
				
			||||||
               (current-source-location)
 | 
					               (current-source-location)
 | 
				
			||||||
                                             #:guile guile-final))))
 | 
					               #:guile guile-final)))
 | 
				
			||||||
    (package/inherit grep
 | 
					    (package/inherit grep
 | 
				
			||||||
                     (inputs (alist-delete "pcre" (package-inputs grep)))
 | 
					                     (inputs (alist-delete "pcre" (package-inputs grep)))
 | 
				
			||||||
                     (native-inputs `(("perl" ,perl-boot0))))))
 | 
					                     (native-inputs `(("perl" ,perl-boot0))))))
 | 
				
			||||||
| 
						 | 
					@ -2443,10 +2442,10 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define sed-final
 | 
					(define sed-final
 | 
				
			||||||
  ;; The final sed.
 | 
					  ;; The final sed.
 | 
				
			||||||
  (let ((sed (package-with-bootstrap-guile
 | 
					  (let ((sed (package-with-explicit-inputs (package-with-bootstrap-guile sed)
 | 
				
			||||||
              (package-with-explicit-inputs sed %boot6-inputs
 | 
					                                           %boot6-inputs
 | 
				
			||||||
                                           (current-source-location)
 | 
					                                           (current-source-location)
 | 
				
			||||||
                                            #:guile guile-final))))
 | 
					                                           #:guile guile-final)))
 | 
				
			||||||
    (package/inherit sed (native-inputs `(("perl" ,perl-boot0))))))
 | 
					    (package/inherit sed (native-inputs `(("perl" ,perl-boot0))))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define-public %final-inputs
 | 
					(define-public %final-inputs
 | 
				
			||||||
| 
						 | 
					@ -2454,9 +2453,9 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
 | 
				
			||||||
  ;; still use 'package-with-bootstrap-guile' so that the bootstrap tools are
 | 
					  ;; still use 'package-with-bootstrap-guile' so that the bootstrap tools are
 | 
				
			||||||
  ;; used for origins that have patches, thereby avoiding circular
 | 
					  ;; used for origins that have patches, thereby avoiding circular
 | 
				
			||||||
  ;; dependencies.
 | 
					  ;; dependencies.
 | 
				
			||||||
  (let ((finalize (compose package-with-bootstrap-guile
 | 
					  (let ((finalize (compose (cut package-with-explicit-inputs <> %boot6-inputs
 | 
				
			||||||
                           (cut package-with-explicit-inputs <> %boot6-inputs
 | 
					                                (current-source-location))
 | 
				
			||||||
                                (current-source-location)))))
 | 
					                           package-with-bootstrap-guile)))
 | 
				
			||||||
    `(,@(map (match-lambda
 | 
					    `(,@(map (match-lambda
 | 
				
			||||||
               ((name package)
 | 
					               ((name package)
 | 
				
			||||||
                (list name (finalize package))))
 | 
					                (list name (finalize package))))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in a new issue