1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-26 20:01:15 +02:00

Optimize small lists

The value pointers of lists with 1 or 2 elements are now stored in the
list value itself. In particular, this makes the "concatMap (x: if
cond then [(f x)] else [])" idiom cheaper.
This commit is contained in:
Eelco Dolstra 2015-07-23 22:05:09 +02:00
parent 14be783676
commit b83801f8b3
11 changed files with 157 additions and 121 deletions

View file

@ -73,7 +73,7 @@ static void parseJSON(EvalState & state, const char * & s, Value & v)
s++;
state.mkList(v, values.size());
for (size_t n = 0; n < values.size(); ++n)
v.list.elems[n] = values[n];
v.listElems()[n] = values[n];
}
else if (*s == '{') {