diff options
author | Ludovic Courtès <ludo@gnu.org> | 2013-01-30 17:05:54 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2013-01-30 17:05:54 +0100 |
commit | fce2394e7defc7d936ef2aad212d20368ef819ff (patch) | |
tree | 7c5766d79cc5cfa1274bbb655b18ec568afab112 /guix/store.scm | |
parent | a9ebd9efd0d97159acbec848ad5fe06f022c8235 (diff) | |
download | gnu-guix-fce2394e7defc7d936ef2aad212d20368ef819ff.tar gnu-guix-fce2394e7defc7d936ef2aad212d20368ef819ff.tar.gz |
store: Slightly improve memoization hashing.
* guix/store.scm (open-connection): Call `make-hash-table' with 100.
(add-text-to-store): Move TEXT first in ARGS, for better `hash'
results.
(add-to-store): Likewise, move ST first.
Diffstat (limited to 'guix/store.scm')
-rw-r--r-- | guix/store.scm | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/guix/store.scm b/guix/store.scm index 7b1da34678..668bc9a019 100644 --- a/guix/store.scm +++ b/guix/store.scm @@ -344,8 +344,8 @@ operate, should the disk become full. Return a server object." (let ((s (%make-nix-server s (protocol-major v) (protocol-minor v) - (make-hash-table) - (make-hash-table)))) + (make-hash-table 100) + (make-hash-table 100)))) (let loop ((done? (process-stderr s))) (or done? (process-stderr s))) s)))))))) @@ -478,7 +478,7 @@ again until #t is returned or an error is raised." "Add TEXT under file NAME in the store, and return its store path. REFERENCES is the list of store paths referred to by the resulting store path." - (let ((args `(,name ,text ,references)) + (let ((args `(,text ,name ,references)) (cache (nix-server-add-text-to-store-cache server))) (or (hash-ref cache args) (let ((path (add-text-to-store server name text references))) @@ -503,7 +503,7 @@ FILE-NAME are added recursively; if FILE-NAME designates a flat file and RECURSIVE? is true, its contents are added, and its permission bits are kept. HASH-ALGO must be a string such as \"sha256\"." (let* ((st (stat file-name #f)) - (args `(,basename ,recursive? ,hash-algo ,st)) + (args `(,st ,basename ,recursive? ,hash-algo)) (cache (nix-server-add-to-store-cache server))) (or (and st (hash-ref cache args)) (let ((path (add-to-store server basename #t recursive? |