aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/eval.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-10-05 01:04:58 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-10-05 01:04:58 +0200
commitb6809608cc467925db44b1eb435095c37e433255 (patch)
tree65eb05089cc9c291febd85a25e917fb12f52e8ff /src/libexpr/eval.cc
parent14188069692215264eb1a25d60920fac7117a2ef (diff)
Get rid of some unnecessary ExprConcatStrings nodes in dynamic attrs
This gives a ~18% speedup in NixOS evaluation (after converting most calls to hasAttr/getAttr to dynamic attrs).
Diffstat (limited to 'src/libexpr/eval.cc')
-rw-r--r--src/libexpr/eval.cc9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index 1eeb80989..5122bd145 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -701,13 +701,10 @@ void ExprAttrs::eval(EvalState & state, Env & env, Value & v)
/* Dynamic attrs apply *after* rec and __overrides. */
foreach (DynamicAttrDefs::iterator, i, dynamicAttrs) {
Value nameVal;
- if (i->nameExpr->es->size() == 1) {
- i->nameExpr->es->front()->eval(state, *dynamicEnv, nameVal);
- state.forceValue(nameVal);
- if (nameVal.type == tNull)
- continue;
- }
i->nameExpr->eval(state, *dynamicEnv, nameVal);
+ state.forceValue(nameVal);
+ if (nameVal.type == tNull)
+ continue;
state.forceStringNoCtx(nameVal);
Symbol nameSym = state.symbols.create(nameVal.string.s);
Bindings::iterator j = v.attrs->find(nameSym);