Thread: nUI5 CPU usage
View Single Post
07-21-13, 12:27 AM   #1
Belechannas
A Warpwood Thunder Caller
Join Date: May 2010
Posts: 86
nUI5 CPU usage

While working on another addon, I wanted to measure the amount of processing time it was using, so I installed the "Broker_CPU Memory" addon and ran about 15 minutes of LFR (essentially 15 minutes of combat). I reset the CPU counters when I entered the instance, to clear out login/initialization activity.

This was the first time I had ever profiled addon CPU usage. The results for my own addon were fine, but nUI's CPU usage surprised me. For the period I sampled, which was again about 15 minutes, nUI used 2 minutes of CPU time, which was 5 times as much as Vuhdo (my character is a healer, so Vuhdo was showing all 25 members and being used continuously), and 10 times as much as Recount. Overall, nUI used twice as much CPU time as my other 40 or so addons combined.

Admittedly, nUI does a lot more than any other single addon, and takes over a number of functions of the Blizzard UI. Of my other addons, Vuhdo is probably the best comparison, since it is also maintaining 26raid frames, monitoring buffs/debuffs on all raid members, etc. In addition, nUI is showing a HUD and managing action buttons. Vuhdo is also parsing the combat log, I believe. So I would naively expect nUI to be perhaps twice as CPU-intensive as Vuhdo. But five times is considerably more than I would have estimated.

So I did a second test, this time standing idle in the Shrine for 15 minutes. I was solo (so only one unit frame), and I used no abilities, so no cooldowns/action button activity, and my health/mana didn't change, so no HUD activity. Surprisingly, while I was totally idle for 15 minutes, nUI used over 2/3's of the CPU time it used in the same amount of LFR combat: about 85 seconds while idle, compared to 120 while in combat almost continuously. For comparison, idle Vuhdo used less than 3% of the CPU time it used in combat (24 seconds in combat, 0.67 seconds out of combat).

I don't care so much about CPU usage while standing around, but wasting all that time while idle MAY indicate that a lot of time is also being wasted while in combat. It also seems possible that the wasted time may be localized to one or two things done in the OnUpdate handler. If so, perhaps some of the inefficiency could be eliminated without massive changes or waiting for nUI6.

Update: Having played around for a while, what I've found is:

60% of the CPU time when idle (solo) is spent in calls to the nUI_Button:OnUpdate routines
30% of the CPU time when idle (solo) is spent in calls to the nUI_UnitAura:OnUpdate routine

the other 10% is divided between everything else.

Last edited by Belechannas : 07-21-13 at 05:01 AM.