From b4866427482cee9837030179af07fd76e31d5f48 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 18 Dec 2025 04:56:37 +0000 Subject: [PATCH] Optimize positions vector allocation with reserve() Co-authored-by: jll63 <5083077+jll63@users.noreply.github.com> --- _codeql_detected_source_root | 1 + include/boost/openmethod/policies/minimal_perfect_hash.hpp | 1 + 2 files changed, 2 insertions(+) create mode 120000 _codeql_detected_source_root diff --git a/_codeql_detected_source_root b/_codeql_detected_source_root new file mode 120000 index 0000000..945c9b4 --- /dev/null +++ b/_codeql_detected_source_root @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/include/boost/openmethod/policies/minimal_perfect_hash.hpp b/include/boost/openmethod/policies/minimal_perfect_hash.hpp index b9e93a0..7a693ca 100644 --- a/include/boost/openmethod/policies/minimal_perfect_hash.hpp +++ b/include/boost/openmethod/policies/minimal_perfect_hash.hpp @@ -313,6 +313,7 @@ void minimal_perfect_hash::fn::initialize( // Check if this displacement works for all keys in group std::vector positions; + positions.reserve(groups[g].size()); bool valid = true; for (auto key : groups[g]) { auto pilot = (mult * reinterpret_cast(key)) >> shift;