Skip to content

Commit

Permalink
Avoid copying an std::vector in a hot path.
Browse files Browse the repository at this point in the history
This brings the avg time for Garrison.age to 6.56s.
  • Loading branch information
Hoikas committed Jun 7, 2021
1 parent 6028e85 commit a60669a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/ResManager/plKeyCollector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ plKeyCollector::~plKeyCollector()
plKey plKeyCollector::findKey(const plKey& match)
{
plKey key;
std::vector<plKey> kList = getKeys(match->getLocation(), match->getType());
const auto& kList = keys[match->getLocation()][match->getType()];
for (unsigned int i=0; i < kList.size(); i++) {
if (*kList[i] == *match) {
key = kList[i];
Expand Down

0 comments on commit a60669a

Please sign in to comment.