mirror of
https://github.com/NixOS/nix
synced 2025-06-25 23:11:16 +02:00
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).
This commit is contained in:
parent
1418806969
commit
b6809608cc
3 changed files with 18 additions and 25 deletions
|
@ -53,16 +53,15 @@ struct Env;
|
|||
struct Value;
|
||||
class EvalState;
|
||||
struct StaticEnv;
|
||||
struct ExprConcatStrings;
|
||||
|
||||
|
||||
/* An attribute path is a sequence of attribute names. */
|
||||
struct AttrName
|
||||
{
|
||||
Symbol symbol;
|
||||
ExprConcatStrings * expr;
|
||||
Expr * expr;
|
||||
AttrName(const Symbol & s) : symbol(s) {};
|
||||
AttrName(ExprConcatStrings * e) : expr(e) {};
|
||||
AttrName(Expr * e) : expr(e) {};
|
||||
};
|
||||
|
||||
typedef std::vector<AttrName> AttrPath;
|
||||
|
@ -173,16 +172,17 @@ struct ExprAttrs : Expr
|
|||
Expr * e;
|
||||
Pos pos;
|
||||
unsigned int displ; // displacement
|
||||
AttrDef(Expr * e, const Pos & pos, bool inherited=false) : inherited(inherited), e(e), pos(pos) { };
|
||||
AttrDef(Expr * e, const Pos & pos, bool inherited=false)
|
||||
: inherited(inherited), e(e), pos(pos) { };
|
||||
AttrDef() { };
|
||||
};
|
||||
typedef std::map<Symbol, AttrDef> AttrDefs;
|
||||
AttrDefs attrs;
|
||||
struct DynamicAttrDef {
|
||||
ExprConcatStrings * nameExpr;
|
||||
Expr * valueExpr;
|
||||
Expr * nameExpr, * valueExpr;
|
||||
Pos pos;
|
||||
DynamicAttrDef(ExprConcatStrings * nameExpr, Expr * valueExpr, const Pos & pos) : nameExpr(nameExpr), valueExpr(valueExpr), pos(pos) { };
|
||||
DynamicAttrDef(Expr * nameExpr, Expr * valueExpr, const Pos & pos)
|
||||
: nameExpr(nameExpr), valueExpr(valueExpr), pos(pos) { };
|
||||
};
|
||||
typedef std::vector<DynamicAttrDef> DynamicAttrDefs;
|
||||
DynamicAttrDefs dynamicAttrs;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue