Skip to content
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

Improve page load performance #1102

Open
josueetcom opened this issue May 12, 2022 · 5 comments
Open

Improve page load performance #1102

josueetcom opened this issue May 12, 2022 · 5 comments
Assignees

Comments

@josueetcom
Copy link
Member

PageSpeed Insights rates our site at 90/100 for Desktop performance and 36/100 for mobile performance:

Screen Shot 2022-05-11 at 8 06 38 PM

We should really address performance issues by leveraging code-splitting (lazy loading) and Suspense:
https://web.dev/code-splitting-suspense/

@josueetcom
Copy link
Member Author

For reference, here is the score after #1108 but before #1114:
Screen Shot 2022-05-14 at 3 13 41 AM

Big gains in FCP and SI scores! #1114 should hopefully address LCP. Still gotta figure out how to improve TI and TBT :P

@josueetcom
Copy link
Member Author

josueetcom commented May 15, 2022

Looks like we have a better score now after merging those two PRs:

Screen Shot 2022-05-15 at 1 03 26 AM

TTI, LCP and TBT have dropped without affecting FCP and SI.

The score seems to vary after a runs but I think this is the first time I've ever seen PageSpeed insights give our site a score of 50+ on mobile.

@josueetcom
Copy link
Member Author

What remains to be improved has to do with the JS we send to the browser. There's a lot of unused code:
Screen Shot 2022-05-15 at 1 14 35 AM

Unfortunately most of it is has to do with Firebase:

  • 15% (175KiB) is for the Firestore library. Loaded for ScholarshipsContext. Not needed for the public home page but is needed for other pages.
  • 14% is for the analytics library (green box at the bottom)
  • And the iframe.js file somewhere is for Firebase Auth. It doesn't always appear but on PageSpeed it says it's 263 KiB and not zipped. In practice though the mobile view in my inspector gives around ~86 KiB and it is gzipped.
  • Everything else there is pretty much needed as far as I can tell.

But, these are some things we could try:

  • Some how code splitting away ScholarshipsContext and its firestore imports so that they're only used on an as-needed basis (e.g. under the /scholarships routes). Nested routes might make sense. This would address 15% of the bundle size and some of the blocking time for pages that don't use the context.
  • Use Firestore Lite instead? We'd be missing some features like caching but we could always change it back later (much easier to go from lite -> full than the other way).
  • Deploy ES2015 to browsers that support it. Apparently the reduction is about 50% or more! Which would be totally worth it, especially as we add more features to the app.

The last one seems the most promising to me, especially since every major browser supports it since March 2017:
Screen Shot 2022-05-15 at 1 38 51 AM

It looks like at least 95.46% of browser versions used in the US fully support ES6. Of the ones tracked, 98.36%. And of mobile users specifically, 99.15%. Definitely seems like an easy win to me!

@josueetcom
Copy link
Member Author

Next step: follow this guide to send modern JavaScript.

@josueetcom
Copy link
Member Author

According to https://estimator.dev/#dreamscholars.org modern JS might only make the site around 12% faster :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant