Decided to revisit optimization the best I could.
Code:
function PI.CycleLoad()
if PI.Queue.Count > 0 then
--print("Items in Queue: loading")
local TimeStart = Inspect.Time.Real()
local Count = 0
repeat
PI.Queue.First.Texture:SetTexture(PI.Queue.First.Location, PI.Queue.First.File)
PI.Queue:Pop(PI.Queue.First)
Count = Count + 1
local Duration = Inspect.Time.Real() - TimeStart
local Average = Duration / Count
if (Average * (Count + 1)) > 0.05 then
break
end
until Inspect.System.Watchdog() < 0.05 or PI.Queue.Count == 0
end
end At first the above was a simple "until" but, I was still getting errors, so I added extra checking with a possible break condition as I was still getting Performance Warnings from people.
Anyhow, after I implemented the above, the result was as follows. Which, may I point out adds extra CPU cycles to ensure the handler conforms to performance standards is more than a little ironic.
Code:
KBM Texture Handler 0.0.3
This addon has caused an internal error. It may not work properly in the future and may cause performance or stability issues.
We recommend disabling this addon, finding an updated version, or reporting the error to the addon's developer.
Error: performance error, execution halted
In KBMTextureHandler / Stage 2 Load Cycle
stack traceback:
KBMTextureHandler/TextureHandler.lua:74: in function <KBMTextureHandler/TextureHandler.lua:67> The Watchdog killed the Texture Handler directly after the Texture had loaded. So, basically, the Performance Warning is pointing at the Addon API itself being horribly optimized not my code.
You really need to dump this Watchdog now. All it's doing is highlighting how bad the API itself is, and not actually helping Devs at all. The fact the Watchdog can blame the simplest of Handlers for Performance means that no matter what us Addon devs do, we'll get blamed regardless.
I stand by my original thoughts that the Watchdog is not practical, poorly implemented and not thought through, you need another solution. Because all you're doing at the moment is providing evidence to your employers that the API is horribly optimized itself. The fact we can use an API command and throw an error blaming us is laughable.
The more I play with this, the more I get the feeling the Trion Addon API Devs are pushing the blame on the real Addon Devs to hide their own performance issues, which is totally unacceptable.
Bookmarks