In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
How exactly does the rendering performance perform?
Application designers render the interface in order to make the application show a great experience, but these gorgeous pictures and transitions can lead to a stuck screen and an unsmooth user experience (such as switching interfaces, sliding scrollbars, etc.).
two。 Understand the principle of rendering performance
Your activity will be redrawn in each 16ms, which means you have to update the screen (including calculation, drawing, etc.) in the 16ms, that is, a 16ms frame. But if you exceed a frame more than 16ms (such as 32ms), it will result in frame loss, that is, in 32ms, you still stop at the previous screen, which will lead to stutters in the interface.
3. The relationship between rendering performance and GPU, CPU
When your application needs to draw buttons, input boxes, etc., to the screen, you need to convert them into pixels and textures on CPU, then send them to GPU (graphics processor) for rasterization, and then present them to the screen.
The speed of the above method is slow, we can speed up the speed through Opengles Api, and Opengles Api can leave the uploaded content in GPU, and then the next time you want to draw, just refer to the existing grid in GPU and tell Opengles Api how to draw.
Basic process of 5.android drawing
The android system converts xml files into GPU acceptable files before you need to draw for the application, and then renders them on the screen. However, this is done with the internal object displaylist (display list), which includes all the information that GPU needs to render, as well as all the commands needed for open GL ES rendering.
For the first time, you will make a display list, and then submit the command to GPU to execute the display list.
If we still want to render this view in the future, such as just changing positions on the screen, we just need to execute the display list again.
If our view changes in the future, the previous display list may not be valid, we need to regenerate the display list, then execute it again, and then display it on the screen.
When the view or layout changes, there will be additional steps, such as a change in the size of the button or a change in the layout position, then the parent container will start the relevant view to recalculate and rearrange the position. this leads to additional rendering. If there are a large number of views that need to be changed, this can cause a lot of performance problems, so what you need is to minimize layout failures.
6. Get to know VSYNC.
VSYNC: vertical synchronization. Before we understand, let's understand the next two concepts.
Refresh rate: the refresh rate of the monitor per second (number of times).
Frame rate: the number of frames GPU can draw per second.
GPU takes the data to draw, and then displays it on the screen.
If the frame rate is greater than the refresh rate of the monitor, it will cause problems such as picture tearing.
The preference for the above problem is that each new frame drawn by GPU overwrites the previous frame, starting at the top. Now, when the screen refreshes, it doesn't know when buffering starts, so the frame he may get from the GPU is incomplete. This means that there are half of the previous frame and half of the current frame, and the solution to this problem is to use double buffering. In fact, GPU draws the frame into memory (also known as background buffering) and copies a copy to the memory sub-area (frame buffer). When he draws the second frame to memory, the framebuffer has no effect. When the screen refreshes, it flushes from the framebuffer, which uses VSYNC. VSYNC avoids copying from the background buffer to the frame buffer when the screen is refreshed.
Therefore, it is ideal that the frame rate is greater than the screen refresh rate, but if the frame rate is less than the screen refresh rate, there will be a problem. This causes the frames on the left and right sides of the screen to display the same when refreshed.
For example, when the frame rate is greater than the screen refresh frequency, the application is smooth, and when the frame rate is suddenly less than the refresh rate, stutters and delays will occur.
7. Reasons for exceeding the 16ms
1. Redraw the content at the view level, which wastes CPU resources.
2.over draw (overdrawn)
3. Running a large number of pictures again and again, resulting in a large number of disturbances in CPU and GPU components.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.