1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 01:51:47 +02:00

Merge pull request #9673 from pennae/drv-parse-opts

optimize derivation parsing
This commit is contained in:
Robert Hensing 2023-12-31 13:49:03 +01:00 committed by GitHub
commit 3511430902
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 95 additions and 41 deletions

View file

@ -140,7 +140,7 @@ static void parseContents(ParseSink & sink, Source & source, const Path & path)
sink.preallocateContents(size);
uint64_t left = size;
std::vector<char> buf(65536);
std::array<char, 65536> buf;
while (left) {
checkInterrupt();

View file

@ -307,7 +307,7 @@ void writeFile(const Path & path, Source & source, mode_t mode, bool sync)
if (!fd)
throw SysError("opening file '%1%'", path);
std::vector<char> buf(64 * 1024);
std::array<char, 64 * 1024> buf;
try {
while (true) {

View file

@ -82,7 +82,7 @@ void Source::operator () (std::string_view data)
void Source::drainInto(Sink & sink)
{
std::string s;
std::vector<char> buf(8192);
std::array<char, 8192> buf;
while (true) {
size_t n;
try {