Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - sophiepeithos

Pages: [1]
1
NGUI 3 Support / Serveral ways to reduce NGUI caused GC Alloc
« on: July 01, 2017, 09:58:18 AM »
I test it in Example 0 - Control Widgets scene on windows standalone player, in unity profiler the GC Alloc of UIPanel.LateUpdate can be reduced from 2.4MB to 1.1MB.
Below is how i do it:
1.if you know exactly how many element will be added to a list, it is better to extend list's capacity first, then do the add. there are serveral places can be improved: UIBasicSprite.SimpleFill, UIBasicSprite.SlicedFill, UIBasicSprite.TiledFill, UIGeometry.ApplyTransform, UIPanel.FillAllDrawCalls, UIPanel.FillDrawCall.
2.NGUI caches at most 10 index buffer, but it can rarely be reused.  lucky you can use a single VaryingList to feed mesh indices to unity, the key point is VaryingList can change its array's length to smaller length without create a new array and copy elements

Pages: [1]