Skip to content

Commit b486642

Browse files
Copilotjll63
andcommitted
Optimize positions vector allocation with reserve()
Co-authored-by: jll63 <[email protected]>
1 parent fe45caf commit b486642

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

_codeql_detected_source_root

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.

include/boost/openmethod/policies/minimal_perfect_hash.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ void minimal_perfect_hash::fn<Registry>::initialize(
313313

314314
// Check if this displacement works for all keys in group
315315
std::vector<std::size_t> positions;
316+
positions.reserve(groups[g].size());
316317
bool valid = true;
317318
for (auto key : groups[g]) {
318319
auto pilot = (mult * reinterpret_cast<detail::uintptr>(key)) >> shift;

0 commit comments

Comments
 (0)