about summary refs log tree commit diff
path: root/src/libexpr/eval.hh
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2012-02-04T13·50+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2012-02-04T13·50+0000
commitf491ae97d472bfd6305a8f3e8c58fac1fdc443a4 (patch)
treee78fed9caf2450915214144f20dd976202d7d1a3 /src/libexpr/eval.hh
parent2bda12ef3b2b1d9a0fc59324d723e3fa883ab223 (diff)
* Inline some functions and get rid of the indirection through
  EvalState::eval().  This gives a 12% speedup on ‘nix-instantiate
  /etc/nixos/nixos/ -A system --readonly-mode’ (from 1.01s to 0.89s).

Diffstat (limited to 'src/libexpr/eval.hh')
-rw-r--r--src/libexpr/eval.hh13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh
index 91004fe4ca39..c4ba170e8cc7 100644
--- a/src/libexpr/eval.hh
+++ b/src/libexpr/eval.hh
@@ -138,18 +138,17 @@ public:
     /* Evaluate an expression to normal form, storing the result in
        value `v'. */
     void eval(Expr * e, Value & v);
-    void eval(Env & env, Expr * e, Value & v);
 
     /* Evaluation the expression, then verify that it has the expected
        type. */
-    bool evalBool(Env & env, Expr * e);
-    void evalAttrs(Env & env, Expr * e, Value & v);
+    inline bool evalBool(Env & env, Expr * e);
+    inline void evalAttrs(Env & env, Expr * e, Value & v);
 
     /* If `v' is a thunk, enter it and overwrite `v' with the result
        of the evaluation of the thunk.  If `v' is a delayed function
        application, call the function and overwrite `v' with the
        result.  Otherwise, this is a no-op. */
-    void forceValue(Value & v);
+    inline void forceValue(Value & v);
 
     /* Force a value, then recursively force list elements and
        attributes. */
@@ -158,8 +157,8 @@ public:
     /* Force `v', and then verify that it has the expected type. */
     int forceInt(Value & v);
     bool forceBool(Value & v);
-    void forceAttrs(Value & v);
-    void forceList(Value & v);
+    inline void forceAttrs(Value & v);
+    inline void forceList(Value & v);
     void forceFunction(Value & v); // either lambda or primop
     string forceString(Value & v);
     string forceString(Value & v, PathSet & context);
@@ -203,7 +202,7 @@ private:
     void addPrimOp(const string & name,
         unsigned int arity, PrimOpFun primOp);
 
-    Value * lookupVar(Env * env, const VarRef & var);
+    inline Value * lookupVar(Env * env, const VarRef & var);
     
     friend class ExprVar;
     friend class ExprAttrs;