Author Topic: Huge performance drop after updatating from 2.7.0 to 3.7.5  (Read 19286 times)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Huge performance drop after updatating from 2.7.0 to 3.7.5
« Reply #15 on: April 16, 2015, 06:50:20 AM »
You are seeing log entries because the scroll bar has to change every single frame as its dimensions change as you drag the scroll view.

Note how in my clean test there was no scroll bar?

Scroll bar changing causes every other widget in that panel to change as well. This is why it's a good idea to move the scroll bar onto its own panel.

newlife

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Re: Huge performance drop after updatating from 2.7.0 to 3.7.5
« Reply #16 on: April 16, 2015, 08:08:08 AM »
I made the same test with the included scroll view panel example and the results are the same when culliing is on, but when culling is off I see 148 logs call in the console.
Can you please check this?
Using NGUI 3.8.2 and Unity 4.5.5.

Anyway, performance of draggable panels are still far away from NGUI 2.7.0.

ArenMook can you please have a look to this? performance degradation is evident even on mid/high end device (Acer iconia tab 8)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Huge performance drop after updatating from 2.7.0 to 3.7.5
« Reply #17 on: April 16, 2015, 08:29:30 AM »
I just told you what the rebuild is caused by, so not sure what else I can look at?

newlife

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Re: Huge performance drop after updatating from 2.7.0 to 3.7.5
« Reply #18 on: April 16, 2015, 09:13:08 PM »
Hello Arenmook,
sorry but i didnt read your previous message.
To my tets, the issue is not only related to scroll bars.
I have another draggable vertical panel used to let the player choose his country. This panel has a lot of entries (one for each country in the world). Each entry is made by a label and a sprite with a button. No scroll bars. After upgrading to NGUI 3, huge performance drop for this panel too. Unusable with cull off, usable but with serious flaws even on decent device (Iconia Tab 8 ) with cull on.
Please advice.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Huge performance drop after updatating from 2.7.0 to 3.7.5
« Reply #19 on: April 18, 2015, 12:46:48 PM »
I would advise you to have a look at endless scroll views example. You can create a scroll view with only a few entries that will be reused as they go out of range.

newlife

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Re: Huge performance drop after updatating from 2.7.0 to 3.7.5
« Reply #20 on: April 18, 2015, 06:48:03 PM »
I would advise you to have a look at endless scroll views example. You can create a scroll view with only a few entries that will be reused as they go out of range.

Aren, thank you for your suggestion, but i REALLY encourage you to examine in depth this issue, its causing a huge performance drop in ANY draggable panel, and this has nothing to do with scroll bar. Tested on the very same device (LGP700), wit the very same interface, the version made with NGUI 2.7.0 is usable while the one made with NGUI 3.8 is mostly unusable (drags occurs after several seconds on the leaderboard panel; its completely unusable on the flags panel).

If you want to test for yourself, this is the link of our app (made with NGU 2.7.0) on google play:

https://play.google.com/store/apps/details?id=com.realdriftportnew.sipon

If you will, I can include you in the beta test page of our new version which is using NGUI 3.8.2, so you can check performance differences.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Huge performance drop after updatating from 2.7.0 to 3.7.5
« Reply #21 on: April 19, 2015, 08:27:52 AM »
newlife, can you make a repro case, so I can try it? Just pm me a link, then I'll take a look.

Preferably with as close a setup to what you have problems with as you can.

newlife

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Re: Huge performance drop after updatating from 2.7.0 to 3.7.5
« Reply #22 on: April 19, 2015, 09:33:01 PM »
newlife, can you make a repro case, so I can try it? Just pm me a link, then I'll take a look.

Preferably with as close a setup to what you have problems with as you can.

I made some further tests with the profiler and it seems that there is a bug with cull option in NGUI 3.x.
I have two version of the same project, one with NGUI 2.7 and the other with NGUI 3.8.
Profiling the project with NGUI 2.7.0 while dragging the draggable panel gave these results:

cull on: 16ms  average frame time
cull off: 4ms   average frame time

Profiling the project with NGUI 3.8.2 while dragging the draggable panel gave these results:

cull on: 15ms  average frame time
cull off: peaks of 290ms , 15ms  average frame time


So the behaviour seems similar with cull on, while with cull off there must be something wrong.
Please let me know what you think.



newlife

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Re: Huge performance drop after updatating from 2.7.0 to 3.7.5
« Reply #23 on: April 20, 2015, 07:09:26 AM »
This issue is reproducible with any draggable panel, the more the entries in the panel the more the issue is evident.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Huge performance drop after updatating from 2.7.0 to 3.7.5
« Reply #24 on: April 20, 2015, 08:08:18 PM »
newlife please create a repro case for me to look at that clearly illustrates the problem. I tried it several times on my end now and cannot see any issues. Culling works as expected, culling off also works as expected. Geometry is not rebuilt while dragging. If I pause the drag operation for a bit, then culling kicks in -- but nothing changes while dragging.

newlife

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Re: Huge performance drop after updatating from 2.7.0 to 3.7.5
« Reply #25 on: April 21, 2015, 07:13:39 AM »
Create two new projects, one with NGUI 2.7 and the other with NGUI 3.7.8. Open the included example (scroll view camera). Remove anything not related to the draggable panel (scroll bar etc.)
We are going to concentrate on cull off cause with cull on results seems similar.
Put a good amount of items in the view (I put 200 items) in order to emphasize the issue.
Open the profiler and set as deep. Simulate a real world user inputs (make some drags with a second of wait between one and the other).

In the attached images you can see the results I got. With NGUI 2.7 there is a big peak at the start of the drag but is narrow and the UI is responsive. With NGUI 3.7.8 there is the same big peak but is much more long and UI is not responsive at all (seconds of waits for a drag).

Please tell me what you think.

newlife

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Re: Huge performance drop after updatating from 2.7.0 to 3.7.5
« Reply #26 on: April 22, 2015, 07:12:58 AM »
Any news regarding this? We are going to release an update of our game today or tomorrow, i would like to know if its possible to fix this.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Huge performance drop after updatating from 2.7.0 to 3.7.5
« Reply #27 on: April 22, 2015, 02:26:49 PM »
Sorry but I can't compare NGUI 2 to NGUI 3. They are very different UI systems, and it would be like comparing a bus to a bike. Both have wheels and can carry people, but how they go about accomplishing that is very different.

If you want me to investigate a specific issue in NGUI 3, as I mentioned please create a repro case for me to look at. You can submit it to support at tasharen.com (email).

Also note that the Professional version of NGUI was optimized recently (side-effect of me looking into this post a few days earlier), so it will perform even better than stock 3.8.2.

newlife

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Re: Huge performance drop after updatating from 2.7.0 to 3.7.5
« Reply #28 on: April 22, 2015, 08:20:46 PM »
ArenMook,
the issue im talking here is a performance drop of the draggable panel after updating from 2.7.0 to 3.x.
So the issue is low performance with draggable panel with a substantial amount of items in it (extremely evident on low power Android device).
The repro case is, as wrote in the previous message:

Open the included example (scroll view camera). Remove anything not related to the draggable panel (scroll bar etc.)
Set cull off.
Put a good amount of items in the view (I put 200 items) in order to emphasize the issue.
Open the profiler and set as deep. Simulate a real world user inputs (make some drags with a second of wait between one and the other).
The issue is that the UI is not responsive at all (seconds of waits for a drag).

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Huge performance drop after updatating from 2.7.0 to 3.7.5
« Reply #29 on: April 24, 2015, 07:40:09 AM »
Deep profile should not be used for anything other than detecting garbage collection allocations. Deep profile performance is ALWAYS wrong. Check Unity's documentation for it. I've explained it dozens of times on this forum already, and the simple explanation is this:

Deep profiling adds a certain amount of overhead to every function call. So say you have one function that takes 1 ms to execute, and another function that takes 0.001 ms. Under normal conditions, first function's execution will take the same time as 1000 of second function's executions. However since deep profile adds overhead, say 0.1 ms... first function's execution becomes 1.1 ms, and second function becomes 0.101 ms. Now 1000 calls to the second function gives you execution time of 101 ms, suddenly making you believe that there is a problem where in fact there isn't one.

Pro version of NGUI's test of your example gives nothing to go by, as I mentioned. The delay between drags does nothing there. When you begin your drag operation, there is a short delay where the big draw buffer gets created from all the widgets (which is expected), and after that -- nothing.