Author Topic: Could you replace the iterators in the NGUI codebase?  (Read 1377 times)

metaleap

  • Guest
Could you replace the iterators in the NGUI codebase?
« on: September 12, 2013, 01:01:42 AM »
This will sound crazy but ... NGUI has a handful of foreach statements, over time such statements accumulate unnecessary garbage adding to GC overhead when the GC does run:

http://www.reddit.com/r/Unity3D/comments/1m667q/060_fps_in_14_days_what_we_learned_trying_to/

Would replace them myself but then you keep updating this awesome package so maybe something to ponder --- stuff like this is so easy to replace with no downside or loss, so hope you'd consider it. All those tiny details do add up at runtime in a non-trivial game  :D

Of course, those foreaches in the Editor scripts can stay. Those don't matter.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Could you replace the iterators in the NGUI codebase?
« Reply #1 on: September 12, 2013, 08:15:31 AM »
Which ones are you referring to? There shouldn't be any 'foreach' statements at run-time unless you're running it on Flash or Windows Phone 8. ActiveAnimation and getting touchCount from UICamera still needs the foreach, but those are generally not used every frame.