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:
parent
f61f67ddee
commit
fa125b9b28
3 changed files with 21 additions and 10 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue