Published by The Android Team Developer Relations
TL;DR
TikTok is available to a broad range of users. With users around the world, it’s inevitable that some of them experience network issues such as slow, intermittent, or expensive connectivity. Others are on entry-level devices that have limited storage and memory. In all of these cases, it is important to provide a seamless app experience. TikTok was able significantly increase their overall performance through the following: Android’s performance guidance, and employing their deep understanding of development tools such as Android Gradle Plugin. Jetpack libraries. Read our article on business to find out how TikTok enhanced their app experience in order to improve business performance. Click here.
Introduction
TikTok, a popular entertainment platform that is community driven, has 1 billion users worldwide who publish and browse video content each day.
A wide user base means different network conditions. Different devices have different processing speeds, screen sizes, memory and processing powers. No matter what device the user uses, they want an app that is responsive and smooth. The app may be slow to load or have playback issues that cause frustration. Users might leave the app and abandon it. TikTok monitors the app’s performance continuously through data monitoring, peer benchmarks and user surveys. This helps to avoid problems like this.
TikTok continues to add new features. Sometimes, however, an increase in functionality may lead to an increase of technical requirements. Engineering team discovered three factors that caused slowdowns in the app: network problems, video playback delay, and janky frames. The TikTok team investigated the following issues. Android These tools will help users start the journey to app development.
Discovery through Solution
The team identified three main goals as priorities: a faster app launch, better user experience and less jank. The team also talked about how to To prevent regression, measure the impact of performance optimization.
1. Refactor startup framework for faster startup
One of the most important metrics is app startup time Android Vitals. Assuring that app startup takes less than 5 minutes Android Vital’s recommendation is the best way to ensure the app loads and starts responding to user activity as quickly as possible. App Startup Library can be found here Android Jetpack library for developers to quickly and easily initialize components of apps.
After studying the App Startup Library in detail, the team restructured the startup framework of the app to allow for on-demand loading as well as precise scheduling. The team also used the background thread to load View components simultaneously to reduce execution time. This improved the app’s startup speed.
TikTok used Simpleperf in order to analyse the execution time of its code. Android Studio uses Profiler for monitoring the utilization of resources like memory, CPU, network, and other networks to optimize I/O, threads and lock downs.
2. User interfaces that are more intuitive
The team had to address two issues in order to create a more intuitive user interface: 1) reduce the View hierarchy so the app renders only what’s necessary, and 2) decrease the number of tasks executed per frame, so the app can maintain a constant frame rate.
In the TikTok Team, Layout Inspector was used Android Studio will help to identify the unneeded layout content. Each View’s layout boundary is clearly shown in the inspector. The team can simplify the View hierarchy to reduce unnecessary content and draw simpler views.
TikTok was used in many situations DoFrame() It is best to work frame-byframe. A jank will occur when you try to squeeze too many tasks into one frame. TikTok adopted an algorithm to allocate tasks to different frames in order to maintain a constant frame rate.
3. Better video playback experience: reuse resources
TikTok users have the ability to create and play audio and video content. Android To access the underlying codec, the MediaCodec Class is provided. It is a good idea to have different media players instances for different codecs in order to improve video playback speed. To provide different media content, the TikTok team built a collection of media player instances that could be used throughout the app. Each media player instance is run in separate threads, to reduce interference.
Another factor that contributes to video lag is network connection speed. To reduce playback lag, the team developed algorithms to adjust buffer length during streaming to optimize connections.
On-device video super resolution was used to produce high-resolution frames using low-resolution content. It further improves video playback and reduces network pressure.
To ensure users enjoy smooth video playback, preloading (loading the next clip ahead of schedule) and pre-rendering (1st frame rendering of the video) are essential components. TikTok created a Surface before it was needed and only added it to the screen when it was actually required. This helped reduce pressure.
4. Regressions should be avoided
Team members continue to have a thorough understanding of the performance of each individual and work to adjust elements as necessary. Luckily, Android Systrace is a tool that captures traces to allow developers to export system activity (including disk activities and CPU scheduling) for analysis. Perfetto and other tools are also used heavily by the team. Android Studio CPU profiler to monitor the execution times of different events, particularly for I/O or class loading
Superior Performance and a Better Experience
TikTok has creatively leveraged Android toolchain to track, quantify, and optimize their app’s performance for its business priorities, resulting in improved user experience and an increase in user satisfaction
Smoothness was improved by 49% and app startup time decreased by 45%. The first frame was 41% quicker when playing video. Video lag is also reduced by 27%.
TikTok users are more likely to use it: the number of active user days in 30 days has increased by 1%, as well as the average session length. User surveys and TikTok’s rating in Google Play also show a significant increase in user satisfaction.
TikTok at the Next Level
By continuously optimizing the app’s performance and adapting as needed Android TikTok 13 has made it easier for users to share, discover and create content.
More than 250,000,000 large-screens are currently active Android The team is also focusing on larger-screen devices worldwide, and has even considered folding devices. The team made TikTok more immersive by adapting the app for large screen devices.
Find out more about TikTok optimization Android The article describes how app can improve the user experience as well as business performance. Click here.
Receive guidance on performance
Learn how to start inspecting, improving and monitoring your app’s performance. Visit our developer guide. You can improve the launch speed of your app by creating a baseline profile for your next release.