Skip to content

Optimize page load times

Alexander Pace requested to merge optimize-js into master

This bugfix patch removes a crazy amount of dojo/dojox/dijit imports and associated downloads for superevent and event pages.

Example: superevent_detail_script.js loaded in dozens of dojox plugins that weren't used anymore (if they were ever?). This had two effects:

  1. some were unavailable for import from cdnjs.cloudflare.com so we had to load a local version of dojo.js, which itself is inefficient and poorly cached.
  2. dojo.js itself would download a dozen other plugins which were loaded, but never used. And since modern browsers download six (?) items simultaneously, there was a queue of downloads (not cached) that would happen as the pages were loading. And since some elements won't activate until the page fully loads, the user just saw the pages crawling to load.

The only element that remains is a paser.parse() that still holds the advocate buttons until the page loads, but that can come from the cdnjs version of dojo now.

The event pages has some other js elements that still need some work, but the superevent pages are substantially cleaned up. Here is an example on gracedb-dev1. Before this patch, it would take ~3.5 seconds for a page to finally load (unached):

Screen_Shot_2023-06-03_at_8.19.47_PM

And after the patch, load times were taken down to ~1.3 seconds (also uncached)

Screen_Shot_2023-06-03_at_8.28.35_PM

The end result is not only increased page performance, but it also means that gracedb is serving substantially less content, so it should help in periods on increased activity when people are mashing the reload button.

Since functionally this is exactly the same but substantially improves performance, I'm pushing to get this into prod ahead of the next planned release.

Merge request reports