diff options
author | Ludovic Courtès <ludo@gnu.org> | 2013-03-16 17:22:20 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2013-03-16 17:23:17 +0100 |
commit | 0bb1aa9e05bd103a71378307b7e26e22fea5ebab (patch) | |
tree | c7d7d66ad34a6e7ebdf463096583ba2c6540db99 | |
parent | d80855999a81f344ca0c994f0532f5bd45162089 (diff) | |
download | guix-0bb1aa9e05bd103a71378307b7e26e22fea5ebab.tar guix-0bb1aa9e05bd103a71378307b7e26e22fea5ebab.tar.gz |
derivations: Optimize `build-expression->derivation'.
This reduces the execution time of
"guix build -e '(@ (gnu packages emacs) emacs)' -d" by 6%, from
1.15s to 1.08s.
* guix/derivations.scm (build-expression->derivation): Write the builder
as UTF-8.
-rw-r--r-- | guix/derivations.scm | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/guix/derivations.scm b/guix/derivations.scm index d70bd9dd85..2243d2ba46 100644 --- a/guix/derivations.scm +++ b/guix/derivations.scm @@ -741,14 +741,21 @@ omitted or is #f, the value of the `%guile-for-build' fluid is used instead." (unsetenv "LD_LIBRARY_PATH"))) (builder (add-text-to-store store (string-append name "-guile-builder") - (string-append - (object->string prologue) - (object->string - `(exit - ,(match exp - ((_ ...) - (remove module-form? exp)) - (_ `(,exp)))))) + + ;; Explicitly use UTF-8 for determinism, + ;; and also because UTF-8 output is faster. + (with-fluids ((%default-port-encoding + "UTF-8")) + (call-with-output-string + (lambda (port) + (write prologue port) + (write + `(exit + ,(match exp + ((_ ...) + (remove module-form? exp)) + (_ `(,exp)))) + port)))) ;; The references don't really matter ;; since the builder is always used in |