Open pdehaan opened 6 years ago
Actually, just before I close this tab, here's a complete breakdown of the 19 network requests via DevTools. I've highlighted any network request over 100 KB in red (bundle.js (664.03 KB), bg3.jpg (283 KB), and hwsurvey-weekly.json (537.23 KB)), and anything over 10 KB in yellow (index.html (16.25 KB), metricsgraphics-dark.css (13.89 KB), and analytics.js (14.83 KB)):
I think we can only shave a couple KB off of the bg3.jpg image (which barely seems worth the effort), and bundle.js was already minimized (using my diff from above). I'm not 100% sure about the https://analysis-output.telemetry.mozilla.org/game-hardware-survey/data/hwsurvey-weekly.json file. When I browse to it, it tries to download to my computer, and it looks like an unminimized 538 KB JSON blob.
Minimizing hwsurvey-weekly.json via jq
, $ jq -c . hwsurvey-weekly.json > hwsurvey-weekly.min.json, gives me a 442 KB file; according to iTerm. So you could potentially shave another 92 KB by simply minimizing the JSON, but that may require a change to analysis-output.telemetry.mozilla.org.
Currently, it looks like https://hardware.metrics.mozilla.com/build/js/bundle.js has a Content-Length of 1,723,137 bytes (or 1,682.750976562 KB or ~1.64 MB). Seems high.
But fear not! It looks like https://github.com/webpack/webpack/issues/2545#issuecomment-334993864 has a potential solution for minifying ES6 code using the uglifyjs-webpack-plugin. I think I have this working locally and it drops the bundle.js Content-Length from 1.64 MB down to 679,591 bytes (or 663.663085938 KB or 0.648 MB). Shaving another 1MB off the page load.
And while 663KB still sounds super big for some JavaScript, I think this is possibly bundling all of our app's JS, plus:
https://hardware.metrics.mozilla.com/:
http://localhost:3000/: