mozilla / ensemble

The platform that powers the Firefox Public Data Report :violin: :trumpet: :musical_keyboard:
https://data.firefox.com/
Mozilla Public License 2.0
20 stars 14 forks source link

https://data.firefox.com/dashboard/hardware is extremely slow to respond to resize or zoom operations #409

Open dholbert opened 2 years ago

dholbert commented 2 years ago

STR:

  1. Visit https://data.firefox.com/dashboard/hardware in Firefox or Chrome
  2. Zoom the page (Ctrl+) or resize your browser-window.
  3. Wait to see the page update in response to your change

EXPECTED RESULTS: The page should repaint with the new zoom level or viewport-size in about the time it takes for its initial rendering (around a second or less).

ACTUAL RESULTS: On my pretty-fast Lenovo laptop, the page takes over 10 seconds to update its rendering (in Firefox as well as Chrome).

This issue is especially-bad in Firefox since it's long enough to trigger our slow-script notification (if you press any keys or attempt to scroll during the hang), and that notification itself triggers another viewport-resize which queues up another batch of the same slow work to happen again. See bug https://bugzilla.mozilla.org/show_bug.cgi?id=1750463. So instead of a 10-20 second hang, you can stretch it into an indefinite-duration hang (as long as you keep interacting with keypresses or scroll events during the hang).

dholbert commented 2 years ago

Nearly all of the work here seems to be calls to getPointAtLength from https://data.firefox.com/static/js/4.582265f3.chunk.js

(Maybe the page is trying to do some sort of intelligent rescaling of its graphed data to the new viewport size, which ends up being more expensive than just rendering it in the first place? It's hard to know, since the JS here is pretty minified.)

Here's a profile captured in Firefox: https://share.firefox.dev/3Hlbyrg ...and in Chrome: https://share.firefox.dev/3rePWHa

In both profiles, there's ~10 seconds' worth of calls to getPointAtLength.