From 652f52f071b127c0bd9f65c432131cf378ed221b Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Thu, 21 Mar 2024 12:59:25 +0100 Subject: 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 --- src/libutil/util.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libutil/util.cc b/src/libutil/util.cc index 645b1ef01..9b65bd77f 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -745,7 +745,7 @@ void drainFD(int fd, Sink & sink, bool block) } }); - std::vector buf(64 * 1024); + std::array buf; while (1) { checkInterrupt(); ssize_t rd = read(fd, buf.data(), buf.size()); -- cgit v1.2.3