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

Research: Improve homepage load time (currently ~1.9 seconds) #3711

Closed
1 of 7 tasks
Tracked by #160
lbeaufort opened this issue Apr 23, 2020 · 5 comments
Closed
1 of 7 tasks
Tracked by #160

Research: Improve homepage load time (currently ~1.9 seconds) #3711

lbeaufort opened this issue Apr 23, 2020 · 5 comments

Comments

@lbeaufort
Copy link
Member

lbeaufort commented Apr 23, 2020

User story As a first-time visitor to fec.gov, I'm more likely to give up and leave if the homepage takes more than a second to load.

We should identify easy ways to improve the homepage load time. At 1.9 seconds, Pingdom gives us a C grade and has an interesting report.

Not an exclusive list of things to check:

  • Compare load with caching vs no caching (hypothesis: slower with caching)
  • Look at both mobile and desktop
  • Look at CDN
  • Look at webpack
  • create separate ticket to address Webpack configuration and approach as mentioned in this comment below

Pingdom

https://my.pingdom.com/app/reports/rbc/5304992

Screen Shot 2020-04-23 at 1 47 07 PM

Google speed test

https://developers.google.com/speed/pagespeed/insights/?url=www.fec.gov
Screen Shot 2020-04-24 at 10 49 16 AM

Screen Shot 2020-04-24 at 10 44 18 AM

Action item

  • break ticket into independent smaller tickets and prioritize accordingly.

Completion criteria:

  • Quick wins are identified and followup tickets are created to address those quick wins
@lbeaufort lbeaufort changed the title Improve homepage load time (1.9 seconds) Improve homepage load time (currently ~1.9 seconds) Apr 24, 2020
@JonellaCulmer JonellaCulmer added this to the Sprint 13.2 milestone Jul 15, 2020
@JonellaCulmer JonellaCulmer changed the title Improve homepage load time (currently ~1.9 seconds) Research: Improve homepage load time (currently ~1.9 seconds) Jul 30, 2020
@johnnyporkchops
Copy link
Contributor

johnnyporkchops commented Jul 30, 2020

The two data visualizations(election search and raising/spending ) that we load below-the-fold on the homepage, may be effecting performance. They are loaded via Django templatetags.
We can consider using these debug tools to evaluate:
Django debug toolbar: https://django-debug-toolbar.readthedocs.io/en/latest/index.html
Update on below toolbar plugin: Unfortunately the below only supports <= Django 1.11
Template-Timings toolbar: https://github.com/orf/django-debug-toolbar-template-timings

@johnnyporkchops
Copy link
Contributor

johnnyporkchops commented Aug 26, 2020

Since I was unable to use the Django template-timing-toolbar to test the performance of the visualizations on the homepage, a less scientific test was to remove them and push to feature and do a Pingdom test. This change does increase load time and raises the performance grade to a B, but the small difference shows that these visualizations are likely not a main issue in load-speed
Screen Shot 2020-08-26 at 12 01 30 PM

@lbeaufort lbeaufort modified the milestones: Sprint 13.3, Sprint 13.4 Aug 28, 2020
@johnnyporkchops
Copy link
Contributor

johnnyporkchops commented Sep 15, 2020

Addressing inefficiencies in our JS and Webpack configuration and approach is a heavy task that should probably be spun off into another ticket. (The below list of possible corrective measures, is by no means, exhaustive)

The size of our compiled Javascript creates a possible opportunity or performance improvement for the homepage and other pages based on the the Google insights results. (First screenshot below) and running Webpack analyzer locally, (second screenshot below).

Based on research using Webpack Analyzer and previous Innovation sprint research done by @rfultz, there is no one change to webpack.config that would improve performance significantly, but more granular reconfiguring may help.

Possible webpack changes
Remove unnecessary calls to scripts based on templates and/or find a more granular way to split compiled scripts into smaller pieces to only be loaded where needed.
- Once we can upgrade to Webpack 5 (related issue), the commonschunk plugin that we are using now is built in to the functionality, but we would have to reconfigure the way we are identifying entrypoints.

For homepage:
Possibly create one entrypoint for homepage that only loads what we need there (including JS for the data visualizations)
- Does homepage need D3? This is big portion of the dataviz common loaded there now
- Does homepage need Juery.dataTables.js ? , another big portion of dataviz-common loaded there.
- If homeapge needs Juery.dataTables.js There are two calls to Juery.dataTables.js (datatables.net-responsive and datatables.net.js. Are these essentially duplicates?
- we could sequence load JS, CSS, Fonts, other assets after initial page load, Then load the other assets like dataviz and init later

For other pages:

  • Look at redefining entrypoints -- possibly based on templates used in /data for example
  • Point to CDNs for vendor files. Or even consider CDNs for our files. This would mean that we can take advantage of cacheing because we would not have to load a new hashed-version file for unchanging assets.

Google Insights https://developers.google.com/speed/pagespeed/insights/?url=www.fec.gov:

Screen Shot 2020-09-15 at 10 28 17 AM

Webpack analyzer plugin running locally, looking at homepage (fec.gov):

Screen Shot 2020-08-27 at 2 04 06 PM

This was referenced Nov 5, 2020
@rfultz
Copy link
Contributor

rfultz commented Nov 5, 2020

I've created tickets based on my findings and experiments ☝️

@rfultz rfultz modified the milestones: Sprint 13.7, Sprint 13.8 Nov 13, 2020
@rfultz rfultz modified the milestones: Sprint 13.8, Sprint 13.9 Nov 30, 2020
@rfultz
Copy link
Contributor

rfultz commented Dec 1, 2020

Closing this as the other tickets have been created. For the record, there's a branch of code whose name starts with feature/3711 where I've committed different experiments and samples

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

No branches or pull requests

6 participants