Found by a static pass with the new .agents/skills/performance-audit skill. Not measured.
Resources::GetDamagetypeImage (GWToolboxdll/Modules/Resources.cpp:964):
IDirect3DTexture9** Resources::GetDamagetypeImage(std::string dmg_type) // by value -> allocation per call
{
if (damagetype_icons.contains(dmg_type)) {
return damagetype_icons.at(dmg_type); // second lookup on the hit path
}
It is called per row, per frame from TargetInfoWindow::Draw (Windows/TargetInfoWindow.cpp:471), so the cache-hit path - which is every frame after the first - pays a std::string construction plus two hashed lookups.
Suggested fix: take std::string_view (or const std::string&) and resolve with a single find(). Worth checking the neighbouring Resources::Get*Image accessors for the same shape while in there (GetProfessionImage at Resources.cpp:929 does the same double lookup).
Found by a static pass with the new
.agents/skills/performance-auditskill. Not measured.Resources::GetDamagetypeImage(GWToolboxdll/Modules/Resources.cpp:964):It is called per row, per frame from
TargetInfoWindow::Draw(Windows/TargetInfoWindow.cpp:471), so the cache-hit path - which is every frame after the first - pays astd::stringconstruction plus two hashed lookups.Suggested fix: take
std::string_view(orconst std::string&) and resolve with a singlefind(). Worth checking the neighbouringResources::Get*Imageaccessors for the same shape while in there (GetProfessionImageatResources.cpp:929does the same double lookup).