From 5166d027308f4cf694f5cff1c0670b6ff622c226 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 27 Oct 2019 22:32:09 +0100 Subject: gnu: bootstrap: 'bootstrap-origin' preserves eq?-ness when no changes are made. This reduces the number of lookups in the 'add-data-to-store' cache from 2743 to 2705 (hit rate: 11% to 10%) when running GUIX_PROFILING=add-data-to-store-cache guix build libreoffice -nd The execution time of "guix build libreoffice -nd" goes from 1.80s to 1.78s. * gnu/packages/bootstrap.scm (bootstrap-origin): Return SOURCE unchanged when its has no patches and no snippet. --- gnu/packages/bootstrap.scm | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'gnu/packages/bootstrap.scm') diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm index ee713db0cf..363c99c7c3 100644 --- a/gnu/packages/bootstrap.scm +++ b/gnu/packages/bootstrap.scm @@ -167,19 +167,22 @@ for system '~a'") ("patch" ,%bootstrap-coreutils&co))) (let ((orig-method (origin-method source))) - (origin (inherit source) - (method (cond ((eq? orig-method url-fetch) - (boot url-fetch)) - (else orig-method))) - (patch-guile %bootstrap-guile) - (patch-inputs %bootstrap-patch-inputs) - - ;; Patches can be origins as well, so process them. - (patches (map (match-lambda - ((? origin? patch) - (bootstrap-origin patch)) - (patch patch)) - (origin-patches source)))))) + (if (or (not (null? (origin-patches source))) + (origin-snippet source)) + (origin (inherit source) + (method (if (eq? orig-method url-fetch) + (boot url-fetch) + orig-method)) + (patch-guile %bootstrap-guile) + (patch-inputs %bootstrap-patch-inputs) + + ;; Patches can be origins as well, so process them. + (patches (map (match-lambda + ((? origin? patch) + (bootstrap-origin patch)) + (patch patch)) + (origin-patches source)))) + source))) (define* (package-from-tarball name source program-to-test description #:key snippet) -- cgit v1.2.3 From ac19950507e941b6263f62f4ee4e8934c1b1598e Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 27 Oct 2019 22:42:59 +0100 Subject: gnu: bootstrap: Cache the 'bootstrap-executable' origins. This reduces the number of lookups in the 'add-data-to-store' cache from 2705 to 2685 (hit rate: 10% to 9%) when running: GUIX_PROFILING=add-data-to-store-cache guix build libreoffice -nd * gnu/packages/bootstrap.scm (raw-build)[->store]: Use 'lower-object' instead of 'origin->derivation'. This allows the origin-to-derivation mapping to be cached. --- gnu/packages/bootstrap.scm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gnu/packages/bootstrap.scm') diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm index 363c99c7c3..c6e3c697e6 100644 --- a/gnu/packages/bootstrap.scm +++ b/gnu/packages/bootstrap.scm @@ -33,6 +33,7 @@ #:use-module ((guix derivations) #:select (derivation derivation-input derivation->output-path)) #:use-module ((guix utils) #:select (gnu-triplet->nix-system)) + #:use-module ((guix gexp) #:select (lower-object)) #:use-module (guix memoization) #:use-module (guix i18n) #:use-module (srfi srfi-1) @@ -348,8 +349,8 @@ or false to signal an error." #:allow-other-keys) (define (->store file) (run-with-store store - (origin->derivation (bootstrap-executable file system) - system))) + (lower-object (bootstrap-executable file system) + system))) (let* ((tar (->store "tar")) (xz (->store "xz")) -- cgit v1.2.3 From 7e1a74da93319a3b413854a052af1e9ccca02bdc Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 3 Nov 2019 17:59:28 +0100 Subject: gnu: bootstrap: Memoize 'bootstrap-origin'. * gnu/packages/bootstrap.scm (bootstrap-origin): Memoize with 'mlambdaq'. This improves memoization of origins in (gnu packages commencement). --- gnu/packages/bootstrap.scm | 69 +++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 34 deletions(-) (limited to 'gnu/packages/bootstrap.scm') diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm index c6e3c697e6..d6995f104c 100644 --- a/gnu/packages/bootstrap.scm +++ b/gnu/packages/bootstrap.scm @@ -149,41 +149,42 @@ for system '~a'") ;;; Helper procedures. ;;; -(define (bootstrap-origin source) - "Return a variant of SOURCE, an instance, whose method uses +(define bootstrap-origin + (mlambdaq (source) + "Return a variant of SOURCE, an instance, whose method uses %BOOTSTRAP-GUILE to do its job." - (define (boot fetch) - (lambda* (url hash-algo hash - #:optional name #:key system) - (fetch url hash-algo hash name - #:guile %bootstrap-guile - #:system system))) - - (define %bootstrap-patch-inputs - ;; Packages used when an has a non-empty 'patches' field. - `(("tar" ,%bootstrap-coreutils&co) - ("xz" ,%bootstrap-coreutils&co) - ("bzip2" ,%bootstrap-coreutils&co) - ("gzip" ,%bootstrap-coreutils&co) - ("patch" ,%bootstrap-coreutils&co))) - - (let ((orig-method (origin-method source))) - (if (or (not (null? (origin-patches source))) - (origin-snippet source)) - (origin (inherit source) - (method (if (eq? orig-method url-fetch) - (boot url-fetch) - orig-method)) - (patch-guile %bootstrap-guile) - (patch-inputs %bootstrap-patch-inputs) - - ;; Patches can be origins as well, so process them. - (patches (map (match-lambda - ((? origin? patch) - (bootstrap-origin patch)) - (patch patch)) - (origin-patches source)))) - source))) + (define (boot fetch) + (lambda* (url hash-algo hash + #:optional name #:key system) + (fetch url hash-algo hash name + #:guile %bootstrap-guile + #:system system))) + + (define %bootstrap-patch-inputs + ;; Packages used when an has a non-empty 'patches' field. + `(("tar" ,%bootstrap-coreutils&co) + ("xz" ,%bootstrap-coreutils&co) + ("bzip2" ,%bootstrap-coreutils&co) + ("gzip" ,%bootstrap-coreutils&co) + ("patch" ,%bootstrap-coreutils&co))) + + (let ((orig-method (origin-method source))) + (if (or (not (null? (origin-patches source))) + (origin-snippet source)) + (origin (inherit source) + (method (if (eq? orig-method url-fetch) + (boot url-fetch) + orig-method)) + (patch-guile %bootstrap-guile) + (patch-inputs %bootstrap-patch-inputs) + + ;; Patches can be origins as well, so process them. + (patches (map (match-lambda + ((? origin? patch) + (bootstrap-origin patch)) + (patch patch)) + (origin-patches source)))) + source)))) (define* (package-from-tarball name source program-to-test description #:key snippet) -- cgit v1.2.3