-
Notifications
You must be signed in to change notification settings - Fork 798
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
Misc Jetpack React performance enhancements #4469
Conversation
@eliorivero - as discussed, could you please finish the work I started in 9b42d1a to fetch stats from the API after page load? This will save 4 calls to WPCOM from most requests. Separately, we should look at making fewer requests during that call, either by combining the 4 requests into 1 or by only fetching the data that's being actively viewed (e.g. just the daily, monthly or yearly stats). |
@gravityrail I've updated the PR with the commit to make Stats data load after page load. It will be cached once it's correctly fetch in the JS object we use to store initial data so when user switches tabs and backs to view Stats they don't have to be fetch again. |
On page load, the property Initial_Status.stats.data is initially set to false. Once the Stats data are properly fetch, it's populated and cached for later use.
@eliorivero works great! A couple of things:
What do you think? Should we merge this and address those in a separate PR? |
@gravityrail we need to introduce skeleton loading in many views that load remote data so we'll surely do that in a separate PR. When the skeleton loading for Stats is introduced, it will take the height of the stats area so that will be addressed too. |
A branch where I'm experimenting with performance issues with Jetpack React.
Baseline:
Loading the Jetpack dashboard takes a pretty long time. On my dev environment, Jetpack dashboard transfers 3.6MB of data, issues 82 DB requests, 125 individual asset requests, 6 back-end API requests to WPCOM, takes ~6-8 seconds of back-end time and and takes 20 - 25 seconds to load on a moderate broadband connection. These stats don't even include back-end time spent within individual API requests to the site.
Things in this branch:
Jetpack::get_connected_user_data( $user_id )
for 1 day (saves 1 WPCOM request for every dashboard load)WIP results:
The upside of all this: For regular users, this should see the load time of the dashboard drop from over 10 seconds to 1-2 seconds, particularly if their cache is primed.