S3BinaryCacheStore:: Eliminate a string copy while uploading

This cuts hydra-queue-runner's peak memory usage by about a third.
This commit is contained in:
Eelco Dolstra 2016-11-16 16:21:30 +01:00
parent 10ae8fabf1
commit 4be4f6de56
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
4 changed files with 17 additions and 3 deletions

View file

@ -155,7 +155,7 @@ static StringSet parseStrings(std::istream & str, bool arePaths)
static Derivation parseDerivation(const string & s)
{
Derivation drv;
std::istringstream str(s);
istringstream_nocopy str(s);
expect(str, "Derive([");
/* Parse the list of outputs. */

View file

@ -145,7 +145,7 @@ struct S3BinaryCacheStoreImpl : public S3BinaryCacheStore
.WithBucket(bucketName)
.WithKey(path);
auto stream = std::make_shared<std::stringstream>(data);
auto stream = std::make_shared<istringstream_nocopy>(data);
request.SetBody(stream);