1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 10:31:15 +02:00

TeeSink: Pre-reserve string space

When receiving a very large file, this can prevent the string from
having tobe copied, which temporarily doubles memory consumption.
This commit is contained in:
Eelco Dolstra 2017-03-01 16:16:04 +01:00
parent f61f67ddee
commit fa125b9b28
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
3 changed files with 21 additions and 10 deletions

View file

@ -583,12 +583,11 @@ static void performOp(ref<LocalStore> store, bool trusted, unsigned int clientVe
if (!trusted && dontCheckSigs)
dontCheckSigs = false;
TeeSource tee(from);
ParseSink sink;
parseDump(sink, tee);
TeeSink tee(from);
parseDump(tee, tee.source);
startWork();
store->addToStore(info, tee.data, repair, dontCheckSigs, nullptr);
store->addToStore(info, tee.source.data, repair, dontCheckSigs, nullptr);
stopWork();
break;
}