Put a throtle on the UpdateBars function, reducing CPU usage to about 20%-40% compared to before, with no loss of threat updates (more savings when in a larger raid).

This commit is contained in:
Xinhuan
2008-12-07 17:30:19 +08:00
parent 2fd0a5763e
commit 1c16bdda99
+12 -3
View File
@@ -1313,8 +1313,19 @@ function Omen:FindThreatMob()
self.unitID = nil
end
local queried = false
-- Frame for throtling updates
local OmenUpdateBarsThrotleFrame = CreateFrame("Frame")
OmenUpdateBarsThrotleFrame:Hide()
OmenUpdateBarsThrotleFrame:SetScript("OnUpdate", function(self, elapsed)
self:Hide()
Omen:UpdateBarsReal()
end)
function Omen:UpdateBars()
OmenUpdateBarsThrotleFrame:Show()
end
local queried = false
function Omen:UpdateBarsReal()
if db.Autocollapse and db.CollapseHide then
-- Update the visibility because it could have been hidden on 0 bars
self.BarList.barsShown = 1 -- Dummy value
@@ -1325,8 +1336,6 @@ function Omen:UpdateBars()
return
end
-- TODO: Put a update throtle on this function
local myGUID = UnitGUID("player")
local dbBar = db.Bar
local mob, mobGUID, mobTargetGUID