mirror of
https://github.com/NixOS/nix
synced 2025-06-27 04:21:16 +02:00
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:
parent
10ae8fabf1
commit
4be4f6de56
4 changed files with 17 additions and 3 deletions
|
@ -431,4 +431,18 @@ void callSuccess(
|
|||
}
|
||||
|
||||
|
||||
/* A variant of std::istringstream that doesn't its string
|
||||
argument. This is useful for large strings. The caller must ensure
|
||||
that the string object is not destroyed while it's referenced by
|
||||
this object. */
|
||||
struct istringstream_nocopy : public std::stringstream
|
||||
{
|
||||
istringstream_nocopy(const std::string & s)
|
||||
{
|
||||
rdbuf()->pubsetbuf(
|
||||
(char *) s.data(), s.size());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue