Author Topic: Performance issues on iphone  (Read 3015 times)

Eskema

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 12
    • View Profile
Performance issues on iphone
« on: April 20, 2012, 02:23:19 AM »
Hi,

I'm experiencing big issues related to performance on iphone. I have a simple menu with this structure


The classical UIRoot(mainmenusd), the camera, and finally attached to the camera I have 2 panels (backgroundpanel and mainoptionspanel) with a bunch of widgets each one. Profiling with xcode I see how the heap grows at an insane rate forcing the garbage collector to appear and screwing my framerate. The more widgets that I have in each panel the more the heap grows.

If I reduce everything to just 1 panel and 1 widget (the background image for example), then the memory allocation is 0 and the heap stays in the same "position", but as soon as I start adding widgets, the memory grows and grows with no control at all.

It doesn't matter if the widgets are within the camera view or if I move one of the panels outside the screen to slide it in (with a tweenposition), the results are the same, the heap grows really quickly

Am I doing something wrong?, is this an expected behaviour?, in case you ask, yes I'm using the latest version as well as previous versions of NGUI with the same results

Cheers,

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Performance issues on iphone
« Reply #1 on: April 20, 2012, 07:21:31 AM »
First of all, ensure you're running the latest version of NGUI. There have been changes that replace all usages of 'foreach' with 'for' loops, which solves the ever-growing heal memory on iOS.

Next, make sure you don't have some ever-moving widget. Moving a widget (or changing color, scaling, etc) causes buffers to be rebuilt every frame. Moving a panel is the better choice as nothing gets rebuilt.

Eskema

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 12
    • View Profile
Re: Performance issues on iphone
« Reply #2 on: April 20, 2012, 08:15:16 AM »
As you can see on the structure I have 2 panels, and I only move the panel via the tweenposition script, there's absolutely nothing else happening. Also the scripts for the buttons has been removed (the tweencolor script included in the default template for buttons) just to make sure that nothing else is happening.
And still the memory is growing like crazy.

I'm gonna check the latest version (at this point I was using 2.0 if I recall properly)