aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/eval.hh
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-03-09 15:09:18 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-03-09 15:09:18 +0000
commit922697c8b27570b6c76a472266507b73f6b79f7f (patch)
treef9e189f6bbc77d036f4ee6c091561710d85cc389 /src/libexpr/eval.hh
parent6dca5c9099b92b6a93071197aa606a31ccd83a37 (diff)
* Big speedup (factor > 2.5) in all nix-env operations that do actual
instantiation, e.g. "nix-env -i" and "nix-env -qas" (but not "nix-env -qa"). It turns out that many redundant calls to addToStore(path) were made, which reads and hashes the entire path. For instance, the bash bootstrap binary in Nixpkgs would be read and hashed many times. As a result nix-env would spend around 92% of its time in the function sha256_block (according to callgrind). Some simple memoization fixes this.
Diffstat (limited to 'src/libexpr/eval.hh')
-rw-r--r--src/libexpr/eval.hh5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh
index 11185159c..602f63fde 100644
--- a/src/libexpr/eval.hh
+++ b/src/libexpr/eval.hh
@@ -11,6 +11,10 @@
typedef map<Path, PathSet> DrvRoots;
typedef map<Path, Hash> DrvHashes;
+/* Cache for calls to addToStore(); maps source paths to the store
+ paths. */
+typedef map<Path, Path> SrcToStore;
+
struct EvalState;
/* Note: using a ATermVector is safe here, since when we call a primop
@@ -24,6 +28,7 @@ struct EvalState
ATermMap primOps;
DrvRoots drvRoots;
DrvHashes drvHashes; /* normalised derivation hashes */
+ SrcToStore srcToStore;
Expr blackHole;
unsigned int nrEvaluated;