From: Joel Rosdahl Date: Thu, 23 Oct 2025 17:25:29 +0000 (+0200) Subject: perf: Call Bytes::resize from Bytes constructors to avoid zero-filling X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0aac6ad5cd6db08d2481e1a2ea8c69a28b24424a;p=thirdparty%2Fccache.git perf: Call Bytes::resize from Bytes constructors to avoid zero-filling --- diff --git a/src/ccache/util/bytes.hpp b/src/ccache/util/bytes.hpp index 327e0c6e..c44da78e 100644 --- a/src/ccache/util/bytes.hpp +++ b/src/ccache/util/bytes.hpp @@ -96,17 +96,13 @@ private: }; inline Bytes::Bytes(size_t size) noexcept - : m_data(std::make_unique(size)), - m_size(size), - m_capacity(size) { + resize(size); } inline Bytes::Bytes(const void* data, size_t size) noexcept - : m_data(std::make_unique(size)), - m_size(size), - m_capacity(size) { + resize(size); std::memcpy(m_data.get(), data, size); }