mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 03:56:01 +01:00
* Store attribute sets as a vector instead of a map (i.e. a red-black
tree). This saves a lot of memory. The vector should be sorted so
that names can be looked up using binary search, but this is not the
case yet. (Surprisingly, looking up attributes using linear search
doesn't have a big impact on performance.)
Memory consumption for
$ nix-instantiate /etc/nixos/nixos/tests -A bittorrent.test --readonly-mode
on x86_64-linux with GC enabled is now 185 MiB (compared to 946
MiB on the trunk).
This commit is contained in:
parent
a247d20604
commit
0b305c534f
7 changed files with 129 additions and 90 deletions
|
|
@ -34,7 +34,7 @@ static void showAttrs(EvalState & state, bool strict, bool location,
|
|||
StringSet names;
|
||||
|
||||
foreach (Bindings::iterator, i, attrs)
|
||||
names.insert(i->first);
|
||||
names.insert(i->name);
|
||||
|
||||
foreach (StringSet::iterator, i, names) {
|
||||
Attr & a(attrs[state.symbols.create(*i)]);
|
||||
|
|
@ -90,16 +90,16 @@ static void printValueAsXML(EvalState & state, bool strict, bool location,
|
|||
Path drvPath;
|
||||
a = v.attrs->find(state.sDrvPath);
|
||||
if (a != v.attrs->end()) {
|
||||
if (strict) state.forceValue(*a->second.value);
|
||||
if (a->second.value->type == tString)
|
||||
xmlAttrs["drvPath"] = drvPath = a->second.value->string.s;
|
||||
if (strict) state.forceValue(*a->value);
|
||||
if (a->value->type == tString)
|
||||
xmlAttrs["drvPath"] = drvPath = a->value->string.s;
|
||||
}
|
||||
|
||||
a = v.attrs->find(state.sOutPath);
|
||||
if (a != v.attrs->end()) {
|
||||
if (strict) state.forceValue(*a->second.value);
|
||||
if (a->second.value->type == tString)
|
||||
xmlAttrs["outPath"] = a->second.value->string.s;
|
||||
if (strict) state.forceValue(*a->value);
|
||||
if (a->value->type == tString)
|
||||
xmlAttrs["outPath"] = a->value->string.s;
|
||||
}
|
||||
|
||||
XMLOpenElement _(doc, "derivation", xmlAttrs);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue