In the process of project development, summed up the Starling performance optimization scheme:
1. Do not frequently read the width height of the display object: the GetBounds () method of the display object is called when the wide-height property is called, and the method iterates through all the child objects of the object and recalculates the width height. When using the wide-height attribute frequently, it is best to save the width to the variable if there is no special need, instead of directly reading the width-height attribute with the value saved by the variable.
2. Flat sprites:starling Each frame will traverse all objects to check their status, upload their data to the GPU for re-rendering, call the Sprite's Flatten () method, Gup will not re-upload the object to render, When you need to update the display object, you can call its Unflatten () method.
3. The Quadbatch:quadbatch class is a flat container, and every time you add an object to a container, it dispatches a "ADDED" and "Added_to_stage" event, and when you have a lot of objects, it's also a big expense. Especially when you use textures that are from the same texture Atlas, Quadbatch is more efficient, and it can only add an instance of an image, Quad, or Quadbatch class.
4. Reduced event Distribution: Starling Display objects will be dispatched a "ADDED" and "Added_to_stage" event when the add is on the stage, and the "Removeed" and "Removeed _to_stage" events are distributed when the removal occurs. Many times these events have no meaning to us, we can modify the Starling display object or customize a display object, rewrite its Addchild method, remove the event distribution, and reduce unnecessary overhead.
5. Clean-up: When destroying an object, ensure that the object and sub-objects are destroyed thoroughly, and the event is removed cleanly, Starling frequently created objects are not destroyed will cause the resource exceeded the upper limit error, resulting in a program crash.
6. Mixed mode: If there is a completely opaque rectangular texture, we can let the GPU disable those texture blending. This is especially useful for large background images. Set object.blendmode = Blendmode.none;
7. Touchenable not clickable: Set touchenable= false for objects that do not need to accept events, and reduce unnecessary time to monitor and distribute.
8. Use bitmap fonts: Replace system fonts with bitmap fonts, and performance will multiply.
9. Texture Atlas: Starling uses the painter algorithm to process the display list, and if all of these textures are loaded from a single atlas, Starling can do all the drawing in one call. A texture atlas that supports a maximum 2048*2048 size in starling.
10. Discard render: When the display object is not in the screen or not within the visual range, we can remove it or set the Visible property to False, which can greatly reduce the pressure of GPU rendering and improve performance.
Image instead of button: Use the image as much as possible without using the button, which is better at rendering speed and overhead than the latter.
12. Basic AS3 Performance optimizations: Use for to override for each, do not create objects frequently in the for loop, assign values to the length property of the array to variables, rather than frequent calls to AS3 good coding habits.
13. Use ATF textures: This format is very powerful, you can use the command line to convert a PNG file into an ATF file (contains file types for different devices, Android (ETC1), IOS (PVRTC), Windows and MacOS (DXT)). Flash player and Air automatically choose the right format based on the operating platform, and the ATF has the advantage of faster rendering speed, smaller memory footprint, faster upload speed and smaller application volume, and is highly recommended.
"Turn from" http://blog.csdn.net/letthinking/article/details/9361059
Starling performance Optimization "Turn"