libutil: don't memset 64k in drainFD

this is not needed and introduces a bunch of memset calls, making up for
3% of valgrind cycle estimation *alone*. real-world impact is a lot
lower on our test machine, but we suspect that less powerful machines
would see an impact from dropping this.

Change-Id: Iad10e9d556e64fdeb0bee0059a4e52520058d11e
This commit is contained in:
eldritch horrors 2024-03-21 12:59:25 +01:00
parent b4d07656ff
commit 652f52f071

View file

@ -745,7 +745,7 @@ void drainFD(int fd, Sink & sink, bool block)
} }
}); });
std::vector<unsigned char> buf(64 * 1024); std::array<unsigned char, 64 * 1024> buf;
while (1) { while (1) {
checkInterrupt(); checkInterrupt();
ssize_t rd = read(fd, buf.data(), buf.size()); ssize_t rd = read(fd, buf.data(), buf.size());