Author Topic: Profiling the Slider component - Tutorial 7 (Android)  (Read 3792 times)

dafide18

  • Guest
Profiling the Slider component - Tutorial 7 (Android)
« on: July 09, 2012, 10:59:11 PM »
Hello ArenMook,
I'm working with NGUI for my work for several month and I just bought it for my personnal project few weeks ago.

I profiled any of your example to check performance cost of component.
Yesterday I found solution to improve Scroll view performance on your forum.

And today I'm looking for sliders example. I didn't found solution on this forum.

I did my profile test on Android with Nexus S phone.

(And you can zoom on each image)
Here my problem, before move, performance is correct lateUpdate cost < 1.6ms (Except sometimes spikes to 3 or 6ms.. strange but don't know why the phone is on my desk I don't touch it...)
http://img195.imageshack.us/img195/951/nguiperformancesliderbe.png

During continuous move, lateUpdate reach 10ms like this :
http://imageshack.us/f/210/nguiperformanceslideraf.png

And it's only for your example of unity project.
I think to display 3 images like a scroller, it's too high cost... the scrolling area had the same problem before the static flag, but now,

On same device the lateUpdate for scroller area with static flag is around 2-3ms (and 5-6 for draggable camera)

Are you aware with this problem ?
Can you give me a way to find how perform that widget (because I nearly sure you have other priority) ?

In my work we use again old NGUI version (because update with last NGUI version broke widget hierarchy and several component seems to be removed / changed and we don't have the time to refactor it). But we realized NGUI scroll view were framerate issues in our game (ios / android game)...
I searched in your code, profiling each code part and I saw several long time in lateUpdate function, UpdateTransform / Widget, UpdateDrawCalls and others long time in draggable camera.

Our code contains a lot of child, and I was sure it would be a problem when I got the initial version of code (from another studio...) and looking in last NGUI updateTranforms / Scrollview (Now it's really better!).

At home I did a lot of test with last NGUI and after several search on this forum, I found the solution with the static flag tips.
The static flag for panel is awesome !
Then I will need to update NGUI later for my working project, just for that feature.

But for my personnal project, I want to check every component I will use and the cost for each...
Then I think slider are actually functionnally good, but performance is bad...
Do you have an idea to reduce the cost of simple sliders ?

One idea for you, could you move any post for reducing framerate Issue in a specific forum category ?
That would be great for Smartphone developper and optimizations helpfull.

Thanks for Plugin because it's really a cool stuff and thanks to improve it every time.
Probably I will share you any part of my code I did to improve NGUI usage.

To start, I send you now a code (I did at home) in private to improve the sprite image browser because when you have a lot of image, it's not easy to find your image with a simple scroll box if you don't know every image name.

Sorry for my english...
David
« Last Edit: July 09, 2012, 11:45:04 PM by David S. »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Profiling the Slider component - Tutorial 7 (Android)
« Reply #1 on: July 10, 2012, 01:57:29 AM »
In that example, the slider is on the same panel as the rest of the window, which means when you move the slider, the entire window gets rebuilt. This means all the sprites, labels, backgrounds... everything.

If you want better performance, move the slider into its own panel (or grouped together with other often-moving widgets).

dafide18

  • Guest
Re: Profiling the Slider component - Tutorial 7 (Android)
« Reply #2 on: July 10, 2012, 08:42:27 PM »
Ok perfect solution to always use:
I put the panel in panel for each and flag the existing panel with other widget in static.
Now the UIPanel.LateUpdate is always nearly 2ms and between 3 and 6ms on some spike.

You can find Screen here :
(I didn't change of device : Android Nexus S)
http://img402.imageshack.us/img402/8522/performancesliderinpane.png

Thanks ArenMook
« Last Edit: July 11, 2012, 10:29:09 PM by David S. »