aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/eval.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-06-11 16:06:01 +0200
committerEelco Dolstra <edolstra@gmail.com>2018-06-12 17:49:55 +0200
commit24c68069948681366ff2351dd7400af6e69006d9 (patch)
treeb82b0ab73f4962977cb6a8dc478e36d5ac75c4ef /src/libexpr/eval.hh
parent6ad0a2f749b4db6b24e8b86625883b0b43ad7ba1 (diff)
Cache parse trees
This prevents EvalState::resetFileCache() from parsing everything all over again.
Diffstat (limited to 'src/libexpr/eval.hh')
-rw-r--r--src/libexpr/eval.hh8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh
index 146f21255..d0f298e16 100644
--- a/src/libexpr/eval.hh
+++ b/src/libexpr/eval.hh
@@ -90,6 +90,14 @@ public:
private:
SrcToStore srcToStore;
+ /* A cache from path names to parse trees. */
+#if HAVE_BOEHMGC
+ typedef std::map<Path, Expr *, std::less<Path>, traceable_allocator<std::pair<const Path, Expr *> > > FileParseCache;
+#else
+ typedef std::map<Path, Expr *> FileParseCache;
+#endif
+ FileParseCache fileParseCache;
+
/* A cache from path names to values. */
#if HAVE_BOEHMGC
typedef std::map<Path, Value, std::less<Path>, traceable_allocator<std::pair<const Path, Value> > > FileEvalCache;