1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-16 07:22:43 +01:00

Store short strings in Values

The vast majority of strings are < 16 bytes, and so can be stored
directly in a Value. This saves a heap allocation and an indirection.
This commit is contained in:
Eelco Dolstra 2019-04-23 12:20:27 +02:00
parent 2160258cc4
commit 742a8046de
10 changed files with 107 additions and 78 deletions

View file

@ -26,9 +26,10 @@ void printValueAsJSON(EvalState & state, bool strict,
out.write(v.boolean);
break;
case tString:
case tShortString:
case tLongString:
v.getContext(context);
out.write(v.string.s);
out.write(v.getString());
break;
case tPath: