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:
commit
3511430902
5 changed files with 95 additions and 41 deletions
|
@ -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();
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue