This paper discusses the reason why Android's screen scrolling is not as smooth and smooth as iPhone's

  • 2020-06-03 08:20:41
  • OfStack

Actually, I think the most main developer for the application of optimization is not enough, or too much Overdraw and Layout, Android developers itself in order to fit the screen resolution and solve other 1 some compatibility problems already spend a lot of energy, there are very few developers spend a lot of energy to do detailed performance optimization, some even don't even know the direction of the optimization. Now the official weibo user side to me in Overdraw is still very serious, and then asynchronously load the image frame rate is not stable, not smooth. Moreover because Android function without a strong platform itself to the application of optimization of rotten can also run very smooth exposed the optimization of the fact that not enough, especially compared to mobile phone manufacturer of custom ROM native system 1 amount sacrificed all some fluency lead to this problem appeared more obvious, so on Android make smooth application to pay more than the iOS energy.

In fact, Google has been making efforts to improve UI performance at the system level in recent years, from hardware acceleration to Project Butter to Reorder & Merge drawing operation and so on, but I feel that Google is not enough to promote Android development best practice, how many Chinese developers have seen Android Session on I/O conference? Almost every year there is Session on system graphics performance. Therefore, there are also problems of domestic developers' development level and vision.

In summary: 1) it is more difficult than iOS to make an application with the same fluency due to the limited performance of Android platform itself; 2) domestic developers know little about the best practice of Android development performance optimization.

update:

Some of the answers to the question that screen touch response rate is the biggest influence on fluency are not reliable. I'm a developer of Android applications myself, and I can question this conclusion with just one example: Why is App built into native systems (such as Nexus5 running Android4.4) so smooth that third-party applications (especially domestic ones) are so commonly compared? Student: They run in the same environment? The screen is one, right? Why is fluency just bad 1? The reason is that SystemApp was developed by Google, and their developers know how to make great applications and know Andorid best practices. However, the developers in the third party have different level, and their optimization experience is not as good as that of SystemApp developers. As a result, the application they write is not as efficient as SystemApp, which is the most important reason.

The first of these tests, which reflect only the delay of the transient response when the finger touches the screen, do not fully explain why the Android is not as smooth as the iOS. I think fluency comes down to two more things: one is touch latency, one is the frame rate of the render, and the latter is more important. Can you imagine that the delay of 100ms from touching the screen with your finger to UI's sliding will make you feel less fluid, or will the unstable frame rate make you feel more sluggish during sliding? In fact, the Google version of Android has been updated in recent years to improve the screen touch delay (find a 4.4 update introduction: Android-4.4 KitKat), although it may not be as good as iOS, But I think the difference in this aspect is very small, the difference in the feeling is also very subtle.

More fluency is reflected in the application of optimization of rotten run unstable frame rate, such as a transient background thread asynchronous after completion of loading images in UI some callback method to display the process execution, if the picture is too large is needed according to the real-time ScaleType zoom to fit the dimensions of the display to ImageView above, this time if the image is too large scale operation time is too long can cause the main thread blocking a long time, has affected the system UI process within unit time slice rendering, lead to the frame. Here's another example to counter the idea that screen touch response is the biggest issue affecting smoothness: Why is it that a single line of text on a sliding list of items will not feel like the card, while a more complex layout of items (such as twitter) will feel like the card? They have the same screen and environment, right? Does touch lag exist? Why is that? This is because the layout of the list items is so complex that the UI control measures the size - during the entire drawing process (onMeasure() > onLayout() assigns location - > onDraw() drawing takes more time, for example, the relative position and size of each UI control may influence each other, which results in more time to calculate the size and position of each frame rendered, and then one more drawing operation to draw all the UI controls during the drawing phase. In the face of the complex interface, experienced developers will try to avoid interface Overdraw transition (drawing), reduce UI hierarchy, choose better ViewGroup (such as FrameLayout performance is better than LinearLayout, LinearLayout performance than RelativeLayout performance is good, but the most powerful adaptability is one of the best RelativeLayout layout ability, realize the function and performance optimization of balance to achieve the optimal need experience), avoid real-time image zooming, avoid frequent the call of the critical path to create objects to reduce gc frequency, Manage Bitmap large objects properly (LruCache), etc. (there are 1 other optimization techniques that are not listed here, of course). And tell what process priority said the answer to the question is not the main reason of Android UI rendering process may not be the highest priority but also is relatively high, don't say he UI render priority setting than the background thread is low, this need to discuss, excessive Google didn't stupid to that point, refuses to see Android SDK source code.

I do not deny that touch screen delay is one of causes of Android sliding doesn't feel smooth, but stood a developer to see perspective, I think under the new versions of existing Android system optimization, his influence is far from application to optimize the impact of the big, well optimized Android applications running on the latest application basic can run with iOS Android version 1 sample fluid.


Related articles: