From 486761934d35fd29ed6ee3def723ba0238253cfc Mon Sep 17 00:00:00 2001 From: Sean Darcy Date: Tue, 23 Apr 2024 12:04:27 +1000 Subject: [PATCH] reserve vector length in fromHexString --- src/utils.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils.cpp b/src/utils.cpp index f6d6bdc..de6241f 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -62,6 +62,7 @@ std::vector utils::fromHexString(std::string_view hexStr) { assert(hexStr.size() % 2 == 0); std::vector result; + result.reserve(hexStr.length() / 2); for (size_t i = 0; i < hexStr.length(); i += 2) { std::string_view byteString = hexStr.substr(i, 2); HexToU8Result hi = hexToU8(byteString[0]);