mirror of
https://github.com/NixOS/nix
synced 2025-06-27 00:11:17 +02:00
Merge pull request #5812 from pennae/small-perf-improvements
improve parser performance a bit
This commit is contained in:
commit
fc2443a67c
9 changed files with 82 additions and 53 deletions
|
@ -668,7 +668,9 @@ void writeFull(int fd, std::string_view s, bool allowInterrupts)
|
|||
|
||||
string drainFD(int fd, bool block, const size_t reserveSize)
|
||||
{
|
||||
StringSink sink(reserveSize);
|
||||
// the parser needs two extra bytes to append terminating characters, other users will
|
||||
// not care very much about the extra memory.
|
||||
StringSink sink(reserveSize + 2);
|
||||
drainFD(fd, sink, block);
|
||||
return std::move(*sink.s);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue