From fa5246a27e9810dd01200bfa695cce9f6fde0a12 Mon Sep 17 00:00:00 2001 From: Parnic Date: Sun, 17 Oct 2010 22:50:59 +0000 Subject: [PATCH] - very minor perf gain by not doing the per-frame update on invisible modules - nuked the primary offender of garbage generation. there is more to get rid of but finding it is a tedious process --- IceBarElement.lua | 3 +++ IceCore.lua | 4 +++- modules/CustomBar.lua | 4 +++- modules/CustomCDBar.lua | 4 +++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/IceBarElement.lua b/IceBarElement.lua index 88b3312..d21ec5b 100644 --- a/IceBarElement.lua +++ b/IceBarElement.lua @@ -1229,6 +1229,9 @@ function IceBarElement.prototype:Update() end function IceBarElement.prototype:MyOnUpdate() + if not self:IsVisible() then + return + end self:SetScale(self.DesiredScale) end diff --git a/IceCore.lua b/IceCore.lua index e4c2be6..1282204 100644 --- a/IceCore.lua +++ b/IceCore.lua @@ -690,7 +690,9 @@ function IceCore.prototype:HandleUpdates() end function IceCore.prototype:RequestUpdates(frame, func) - self.updatees[frame] = func + if self.updatees[frame] ~= func then + self.updatees[frame] = func + end local count = 0 for k,v in pairs(self.updatees) do diff --git a/modules/CustomBar.lua b/modules/CustomBar.lua index e20f0c8..d7bdb69 100644 --- a/modules/CustomBar.lua +++ b/modules/CustomBar.lua @@ -48,7 +48,9 @@ end function IceCustomBar.prototype:ConditionalSubscribe() if self:ShouldAlwaysSubscribe() then - IceHUD.IceCore:RequestUpdates(self.frame, function() self:UpdateCustomBar() end) + if not IceHUD.IceCore:IsUpdateSubscribed(self.frame) then + IceHUD.IceCore:RequestUpdates(self.frame, function() self:UpdateCustomBar() end) + end else IceHUD.IceCore:RequestUpdates(self.frame, nil) end diff --git a/modules/CustomCDBar.lua b/modules/CustomCDBar.lua index 44d339a..30e02a2 100644 --- a/modules/CustomCDBar.lua +++ b/modules/CustomCDBar.lua @@ -436,7 +436,9 @@ function IceCustomCDBar.prototype:EnableUpdates(enable_update) end if enable_update then - IceHUD.IceCore:RequestUpdates(self.frame, function() self:UpdateCustomBar(true) end) + if not IceHUD.IceCore:IsUpdateSubscribed(self.frame) then + IceHUD.IceCore:RequestUpdates(self.frame, function() self:UpdateCustomBar(true) end) + end else IceHUD.IceCore:RequestUpdates(self.frame, nil) end