From a60669a5dea8bceeaa669079939486c4d858e712 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Mon, 7 Jun 2021 02:41:01 -0400 Subject: [PATCH] Avoid copying an `std::vector` in a hot path. This brings the avg time for Garrison.age to 6.56s. --- core/ResManager/plKeyCollector.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/ResManager/plKeyCollector.cpp b/core/ResManager/plKeyCollector.cpp index 7e1403da2..272ce79c6 100644 --- a/core/ResManager/plKeyCollector.cpp +++ b/core/ResManager/plKeyCollector.cpp @@ -44,7 +44,7 @@ plKeyCollector::~plKeyCollector() plKey plKeyCollector::findKey(const plKey& match) { plKey key; - std::vector 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];