Author Topic: Very slow performance on Flash target  (Read 3571 times)

marasto

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Very slow performance on Flash target
« on: April 02, 2013, 11:57:41 AM »
Hi,

UIPanel.LateUpdate is very slow. Actually it takes the 98% of the frame time. Using Scout I found that the majority of the time is spent in FillGeometry, UpdateTransform and UpdateWidgets

UIPanel.UIPanel_LateUpdate (global)            17   0%   55,673   89%
UIPanel.UIPanel_Fill_Material (global)           193   0%   24,629   39%
UIPanel.UIPanel_UpdateTransforms (global)   311   0%   15,492   24%
UIPanel.UIPanel_UpdateWidgets (global)           143   0%   15,016   24%

Going a bit deeper inside FillMaterials


UIWidget.UIWidget_WriteToBuffers_BetterList$1... (global)   68   0%   13,163   21% -> copy constructor of vector3 etc are evil..
UIDrawCall.UIDrawCall_Set_BetterList$1...(global)           81   0%   7,062           11%  -> BetterListToArray conversion is critical here

And inside here the most costly functions are usually the Vector3 copy constructor and iteration over KeyValue pairs. Regardless of the timing it is quite surprising.

Is it true that I didn't mark the Panel as static and there are buttons that change UV and potentially other things that may move.. But it shouldn't regenerate the geometry every frame.. or updating so much things.

It was all static and nothing was moving.. There is a draggable panel here but it was not scrolling. There are some Anchor that update but they shouldn't affect the positions (apart at the first frame)

Wondering if there is some bug or something that continue to mark the panel as changed.. (I'm going to check). In any case does someone else have any problem with performance with Flash build ?








Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Very slow performance on Flash target
« Reply #1 on: April 02, 2013, 12:05:20 PM »
You are likely moving widgets around inside a panel, which causes the panel to have to rebuild the geometry every frame. This can cause low performance in the manner you described.

marasto

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Re: Very slow performance on Flash target
« Reply #2 on: April 02, 2013, 12:48:02 PM »
Hi Nicki

no, I'm moving anything. It is all completely static.
And I verified that in fact in Editor nothing it is really changing and no WriteBuffer is called.
Just to test I marked the panels as static and I got some improvement: no writebuffer etc etc .. As espected. But that should not be necessary. And also cause me other issue.. 
But there is one or two situation where it continue to rewrite some buffers while nothing is moving or changing. And this only in Flash (or maybe also in any other Standalone).


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Very slow performance on Flash target
« Reply #3 on: April 02, 2013, 10:57:44 PM »
FillGeometry is only called if something is actually changing. This "something" can be caused by movement, color change, alpha change, etc. Profile it in Unity for more information.