Context:
I wrote Google on the Android performance optimization Video course translation, I hope the reprint does not delete my blog address http://blog.csdn.net/zhjali123
Terms:
1.texture, meshes. For example, to make a plane model, you have to carve out a three-dimensional plane model (mesh), but the model has not been painted, this is you want to wrap it with a piece of paper, the above camouflage, this layer of camouflage paper is (texture, Chinese called texture).
Lesson1:render (Rendering)
1.Android devices are typically 16ms updated under activity, depending on the phone hardware. This means that you have to process all your drawing logic within 16ms. If you miss this 16ms, the page will not be drawn, which is called dropped frame. However, the operation of the animation does not stop, so the user is presented in the smoothness of the jump. This is called laggy or janky experience.
The 2.Android rendering channel is divided into two key areas: CPU and GPU.
CPU (Measure measurement-->layout layout--->record record--->execute execution)---->GPU (rasterization rasterization: Calculates the value of each pixel)
CPU issues: Unnecessary layout, meaningless computations, splits (torn down), rebuilds (rebuilt) in view hierarchy (hierachy)
The principle process of converting XML to screen display:
XML----Transformation---->screen, core step: Rasterization rasterization (). Rasterization is very resource-intensive, so a separate image processing unit GPU was introduced in the 90 's. The GPU uses a number of specified base instruction sets (set of primitive:polygons polygons, textures, images images), and the CPU will input these instructions (a set of primitive) to the GPU before drawing things to the screen. The API that this process typically uses is the OpenGL ES for Android.
This means that if you draw a button, he will first convert to polygons polygon, texture texture (computer graphics) an image in the CPU applied to a polygon to create the appearance of a surface: images are added to a polygon to create the appearance of things)------------"passed to the GPU for rasterization grating Of.
There are two time-consuming operations:
1. Convert the button and other things into the corresponding shape (polygons) in the CPU, drawing its surface (texture)
2.CPU transferring data to the GPU
Corresponding measures:
You want to reduce the things drawn in the CPU and the CPU to upload data to the GPU, and OpenGL ES provides an API to upload data and save data to the GPU. So, the next time you draw a button, you just need to refer to it in the GPU (that is, complete polygons, texture in the GPU) and tell OpenGL how to draw it. One rule of thumb: optimizing rendering performance means uploading data as fast as possible to the GPU and preserving data as long as possible on the GPU.
Starting with the honeycomb version, the entire view is rendered on the GPU and is constantly being optimized so you don't have to worry about it. For example: any resource provided by your theme, such as bitmaps, drawables, etc., is integrated into a single texture (feeling is the meaning of the surface of the thing), and then uploading to the GPU using meshes as a point 9 figure. So every time you need to draw these resources, you don't have to do any conversion, they're already stored in the GPU.
However, as UI things become more advanced, the drawing process is more complex. For example, drawing an image, which means uploading an image to the CPU and to the GPU. Using path is completely different, you need to create a series of polygons polygons in the CPU, or even create masking texture (mask textures) in the GPU to define path. To draw a character, you must first draw an image---in the CPU to the GPU---draw a square of characters in each string on the screen, which are processed by the Android system. And there are GPU problemsthat programmers will encounter overdraw (over-Drawing)
Go on translating this evening!
Android performance optimization Google course translation