From 6c1f4faff2602a6d834d8f641a8a39783bbb9465 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Thu, 20 Jul 2023 19:26:10 +0200 Subject: animationmgr: avoid looping over all avars in favor of only active ones --- src/managers/AnimationManager.cpp | 7 +------ src/managers/AnimationManager.hpp | 3 ++- 2 files changed, 3 insertions(+), 7 deletions(-) (limited to 'src/managers') diff --git a/src/managers/AnimationManager.cpp b/src/managers/AnimationManager.cpp index 0973c759..2f2977c4 100644 --- a/src/managers/AnimationManager.cpp +++ b/src/managers/AnimationManager.cpp @@ -58,12 +58,7 @@ void CAnimationManager::tick() { std::vector animationEndedVars; - for (auto& av : m_lAnimatedVariables) { - - // first of all, check if we need to update it at all - // TODO: this has a 100% cache miss rate, maybe move active avars to a separate vec - if (!av->m_bIsBeingAnimated) - continue; + for (auto& av : m_vActiveAnimatedVariables) { if (av->m_eDamagePolicy == AVARDAMAGE_SHADOW && !*PSHADOWSENABLED) { av->warp(false); diff --git a/src/managers/AnimationManager.hpp b/src/managers/AnimationManager.hpp index db7055c8..6d2830fd 100644 --- a/src/managers/AnimationManager.hpp +++ b/src/managers/AnimationManager.hpp @@ -25,7 +25,8 @@ class CAnimationManager { std::unordered_map getAllBeziers(); - std::list m_lAnimatedVariables; + std::vector m_vAnimatedVariables; + std::vector m_vActiveAnimatedVariables; wl_event_source* m_pAnimationTick; -- cgit v1.2.3