In the world of mobile app development, ensuring a smooth and seamless user experience is crucial. Two critical performance metrics that can significantly impact user experience are jank and stutter. In this article, we will dive deep into understanding jank and stutter, their causes, how to calculate them, and how tools like PerfDog can help developers identify and address these performance issues effectively.
Jank refers to the disruptions in an app's UI smoothness, caused by the app's inability to render frames in sync with the device's screen refresh rate. On a 60Hz screen, the ideal frame rendering time is 16ms (1 second / 60 frames). When an app takes longer than 16ms to render a frame, it misses the screen's refresh cycle, causing a noticeable pause or jump in the UI. This disruption in smoothness is called jank.
Jank can be caused by various factors, including:
● Complex UI elements: If the app's UI is too complex or contains many elements, rendering a frame might take longer than the ideal 16ms.
● Resource-intensive operations: Heavy computations or operations, like loading large images or running complex animations, can slow down frame rendering.
● Garbage collection: Inefficient memory management can lead to garbage collection events, causing the app to pause momentarily while freeing up memory.
● Main thread blocking: Running resource-intensive tasks on the main thread can block UI updates, leading to jank.
While jank refers to individual instances of frame rendering delays, stutter is a term used to describe the uneven distribution of frame rendering times. An app can achieve a high average FPS (frames per second) but still appear choppy to the user if the frame rendering times vary significantly. This unevenness in frame rendering times is called stutter.
Stutter can be caused by factors such as:
● Variable workload: If the app's workload varies significantly between frames, it can lead to uneven frame rendering times.
● Inefficient code: Poorly optimized code can cause some frames to take longer to render than others.
● Synchronization issues: If the app relies on multiple threads or processes that need to synchronize, it can cause delays in frame rendering times.
To calculate jank, you can analyze the frame rendering times and identify frames that took longer than the screen's refresh cycle (e.g., 16ms for a 60Hz screen) to render. The jank rate can be calculated by dividing the number of janky frames by the total number of frames.
In PerfDog's Jank analysis, FrameTime plays a crucial role in calculating Jank. Here's how it works:
1. Visual Inertia and Average FrameTime: PerfDog takes into account visual inertia and the average FrameTime of the previous three frames. Visual inertia refers to the expected FPS based on the current FPS. If the refresh FPS suddenly drops, it will disturb the user's visual inertia, leading to a Jank experience.
2. Calculating Jank: If the FrameTime of the next frame is longer than twice the average FrameTime of the previous three frames, it is considered a potential Jank.
3. Real Jank and Big Jank: If the FrameTime of a single frame is longer than twice the movie FrameTime (1000ms/24*2), it is considered a real Jank. If the FrameTime of a single frame is longer than three times the movie FrameTime, it is considered a Big Jank.
4. Stutter Calculation: Stutter, which is the proportion of Jank time during testing, is also calculated based on FrameTime. It is calculated as the sum of Jank times divided by the total test duration.
● Jank calculation by really testing FrameTime
PerfDog's Stutter is defined as the proportion of Jank time during testing, calculated as the sum of all Jank times divided by the total test duration. This measure provides a comprehensive view of the overall performance of your application or game, as it takes into account all instances of Jank that occur during testing.
Here's how PerfDog calculates Stutter:
1. Jank Time: Each instance of Jank has a corresponding Jank time, which is the duration of that specific performance hiccup.
2. Multiple Janks: During testing, multiple instances of Jank may occur, each with their own Jank times.
3. Total Test Duration: This is the total time span of the testing session.
4. Stutter Calculation: Stutter is calculated as the sum of all Jank times (∑Jank time) divided by the total test duration (Time).
Stutter = ∑Jank time / Time
It's important to note that while Jank indicates the number of times performance hiccups occur (Jank times), Stutter represents the rate of these hiccups (Jank rate). The trends of Jank and Stutter are generally consistent, but not completely linear, as the severity of Jank can vary at different times. If no Jank occurs, the Stutter will be zero, indicating a smooth and seamless user experience.
● Performance of some mainstream games:
In the current market, mainstream games are compared based on their Stutter rates, providing a benchmark for performance optimization. By understanding and monitoring Stutter, developers can identify and address performance issues, enhancing the overall user experience.
PerfDog is a performance analysis tool that offers real-time monitoring and comprehensive data analysis for mobile applications, helping developers identify and address performance issues like jank and stutter.
PerfDog's real-time monitoring enables developers to spot janky frames as they occur, displaying the rendering time for each frame and making it easy to identify frames that exceed the ideal threshold. This immediate feedback allows developers to quickly pinpoint and address the source of the jank.
To help with stutter, PerfDog provides detailed frame time data, which developers can use to analyze the distribution of frame rendering times. By studying this data, developers can identify patterns and trends that may be contributing to stutter, such as specific operations or processes that cause frame rendering times to spike.
In addition to these features, PerfDog also offers advanced performance parameter controls, log collection, multi-process testing, and more, making it an invaluable tool for developers looking to optimize their apps' performance.
Understanding and addressing jank and stutter is essential for providing a smooth and enjoyable user experience. Tools like PerfDog can play a crucial role in this effort, offering the data and insights developers need to optimize their apps' performance effectively. With its real-time monitoring, comprehensive data analysis capabilities, and advanced features, PerfDog is a powerful ally in the fight against jank and stutter.