New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stats: Improve scrolling performance #22847
Open
staskus
wants to merge
7
commits into
trunk
Choose a base branch
from
task/22721-stats-traffic-improve-scrolling-performance
base: trunk
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Stats: Improve scrolling performance #22847
staskus
wants to merge
7
commits into
trunk
from
task/22721-stats-traffic-improve-scrolling-performance
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TopTotalsCell was calling addRows on every configuration of cell which in turn created and added a hierarchy of UIStackView-based views. Optimizing TopTotalsCell to only add rows once and then make manipulations on existing rows.
📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
|
staskus
changed the title
Stats Traffic: Improve scrolling performance
Stats Period: Improve scrolling performance
Apr 10, 2024
staskus
changed the title
Stats Period: Improve scrolling performance
Stats: Improve scrolling performance
Apr 11, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #22721
Majority of Stats Traffic / Stats Period scrolling hitches happen due to inefficient
TopTotalsCell
load, mainly calls toaddRows
which creates and adds multiple layers ofUIStackViews
every time the cell is configured.Investigation: pc8eDl-1pe-p2
Solution
UIStackView
only once when the table view loads. When other cells reuse the same views, only configure or hide existing views.setNeedsLayout
instead oflayoutIfNeeded
This is only the first iteration of possible improvements. I didn't achieve a full smooth experience and animation hitches still happen after the first load. However, the improvements are measurable and visible, especially when testing on a debugger-connected iPhone.
Performance Comparisons
I decided to compare the performance of cell configuration methods by measuring how much time it takes to fully configure the cell. When testing, I use a high-traffic site and scroll up and down three times.
TopTotalsCell
iPhone 14 Pro
CountriesCell
iPhone 14 Pro
All Stats Cells Averages
The improvement of the configuration of all the Stats cell averages falls somewhere in between of two numbers.
iPhone 14 Pro
Hitches Comparisons
Before
After
Remaining Hitches
The majority of those remaining hitches are caused by issues that couldn't be identified or sometimes identified simply as
main
using Time Profiler:To test:
trunk
with a debugger connectedtask/22721-stats-traffic-improve-scrolling-performance
with a debugger connectedRegression Notes
TopTotalsCell is only used within Stats, doesn't affect any other areas
Manual testing, and performance measurement
None
PR submission checklist:
RELEASE-NOTES.txt
if necessary.Testing checklist: