Author Topic: NGUI Performance after flash conversion  (Read 2841 times)

sgonchar

  • Guest
NGUI Performance after flash conversion
« on: August 17, 2012, 12:55:33 PM »
Hello,

We recently did first to flash conversion and found a few areas we'd like to improve on.
In Unity total UI cost is around 3%. In flash it's just above 30%. Any help is much appreciated.
We are on NGUI 2.1.0.

We already know that vast majority of the cost of UI in Unity is in UIPanel.UpdateWidgets(). Vast majority of that is in node.HasChanged() (in UpdateTransforms). In flash the two loops foreach (KeyValuePair<Transform, UINode> c in mChildren) in UpdateWidgets() and in UpdateTransforms() seems to be quite expensive as well.

In flash it seems cost of HasChanged() is multiplied by at least 10x.
FYI we have close to 350 nodes in our UI.

It seems optimizing HasChanged() in Flash is an easy win. For whatever reason just in Flash the transform gets and compares (both vector and quaternions) are much more expensive then in Unity. Does anyone know why that happens? Is there something flash is faster at comparing?

Lower priority is to try make the foreach loops run faster (or maybe not use foreach?) Is foreach in this case faster then just a for loop? (#if UNITY_FLASH implies that it is).

Thank you.
Cheers.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI Performance after flash conversion
« Reply #1 on: August 17, 2012, 06:53:12 PM »
Unfortunately Flash in Unity is very limited, and does not support some functionality that made it possible to optimize NGUI for all other platforms. Search for #if UNITY_FLASH and see what I mean. I had to add a lot of work-arounds to get everything running on Flash.

Simply put, Flash in Unity sucks donkey nuts.