aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-03-21 12:59:25 +0100
committereldritch horrors <pennae@lix.systems>2024-03-23 22:17:46 +0000
commit652f52f071b127c0bd9f65c432131cf378ed221b (patch)
tree7443b3f6eefa517139b689fe99fbf0c9f841b3d2
parentb4d07656ff2c43b1144eb97658b9528dd39418ce (diff)
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
-rw-r--r--src/libutil/util.cc2
1 files changed, 1 insertions, 1 deletions
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<unsigned char> buf(64 * 1024);
+ std::array<unsigned char, 64 * 1024> buf;
while (1) {
checkInterrupt();
ssize_t rd = read(fd, buf.data(), buf.size());