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

Modernize the dashboard JavaScript and improve things #558

Merged
merged 103 commits into from
Jun 30, 2023
Merged

Modernize the dashboard JavaScript and improve things #558

merged 103 commits into from
Jun 30, 2023

Conversation

ivan
Copy link
Contributor

@ivan ivan commented Jun 9, 2023

Notable changes:

  • convert the JavaScript from ES5 to ES2020
  • move dashboard JavaScript to its own file so that we can format it with rome check
  • reduce default historyLines from 1000 to 500 to compensate for many more jobs than before
  • optimize: remove animations for all browsers, add CSS contain and content-visibility on log windows
  • optimize: avoid reflows by not scrolling hidden log windows (was ~40% of our time in Firefox, ~30% in Chrome)
  • limit the size of the BatchingQueue to fix the issue that caused Chromium-based browsers to hang when returning to the tab
  • context menu: limit to 8 ignore suggestions until you click to show more
  • context menu: create ignores based on the original URL characters
    (Dashboard escapes { and } as %7B and %7D when copying ignores from context menu #340)
  • start with all jobs collapsed by default and add &initialFilter= URL parameter
  • document more URL parameters in the help text, including &loadRecent=0 to skip loading recent data
  • show progress when loading the recent data
  • show WebSocket messages/sec and KB/s
  • if uBlock Origin cosmetic filtering is detected, tell user to read help and turn off ad blocker
  • CSS improvements: make font sizes, families, and weights more consistent

I had to move some dashboard3 things to avoid confusing the two dashboard JavaScript files.

I didn't test whether the Ruby still serves things correctly.

obsolete tests results for 9cf8f41

Test results with all job windows collapsed, Chrome 116.0.5817.5 (Official Build) dev (64-bit) on Windows 10 22H2 on an ancient laptop (Intel Core i7-2620M), no browser extensions:

9cf8f41 uses 55% of the CPU time of the current dashboard and ~25% as much memory.

archivebot dashboard in chrome 2023-06-09_23-34-41 668182


Test results with all job windows collapsed, Firefox 114.0 on Windows 10 22H2 on an ancient laptop (Intel Core i7-2620M), no browser extensions:

9cf8f41 uses ~95% of the CPU time of the current dashboard and about the same amount of memory (it fluctuates as Firefox takes a while to do a full GC).

archivebot dashboard in firefox 2023-06-09_23-43-23 246469

Unlike Chrome's Task Manager, Firefox's about:processes doesn't have a CPU time column, so the difference is less measurable.


Test results with all job windows collapsed, Chrome 116.0.5817.5 (Official Build) dev (64-bit) on Windows 10 22H2 on an ancient laptop (Intel Core i7-2620M), no browser extensions:

f7d5b1a uses 40% of the CPU time of the current dashboard and ~25% as much memory.

ab in chrome 2023-06-10_00-25-52 051314


Test results with all job windows collapsed, Firefox 114.0 on Windows 10 22H2 on an ancient laptop (Intel Core i7-2620M), no browser extensions:

f7d5b1a uses ~57% of the CPU time of the current dashboard and about the same amount of memory (it fluctuates as Firefox takes a while to do a full GC).

Unlike Chrome's Task Manager, Firefox's about:processes doesn't have a CPU time column, so the difference is less measurable.

ab in firefox 2023-06-10_00-30-19 177453

ivan added 30 commits June 7, 2023 22:43
The dashboard displays 2-3 times as many jobs as it used to, and we need to do something to mitigate the performance impact.
Their performance wasn't good enough in Chrome, even on a 7950X3D.
We don't really need a dynamic !con; it's easy enough to backspace and change the number yourself.
…t Chrome

Natively, browsers either make mousewheel close the context menu (Chrome on
Windows), or swallow all mousewheel events while the context menu is open,
doing nothing until the context menu is closed (any browser on macOS).

We might want to implement that swallowing behavior later for some
(browser, OS) combinations, but it's not very important.
This is the result of:

rome check dashboard/dashboard.js --apply-unsafe --line-width 120

with my own manual changes to `getSummaryResponses` and the replacement of some `// comments` with `/* comments */`
ivan added 22 commits June 9, 2023 11:30
More predictable, less annoying (doesn't break ctrl+a and other keys after focusing the input)
…onds

Limited to 31 max readings, to be fixed in an upcoming commit.
…rage the rate over 3 sec and remove the cap on the number of readings
…at lines fit nicely (at least when there is no horizontal scrollbar)
…batchTimeWhenVisible

This reduces CPU usage.
…very filter change

`updateAlign` was seen using a lot of CPU time in the Chrome DevTools profiler.
Inspired by SEDA's batching, of course.
This reduces CPU use by ~43% in Firefox and ~30% in Chrome.

Scroll log windows to the bottom only after they are unhidden again.
…g strings in the queue

This doesn't make much of a difference, but it seems pointless to batch
the parsing of JSON strings, given that JSON.parse is both fairly small
and likely to be hot.
Copy link
Contributor

@JustAnotherArchivist JustAnotherArchivist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So many changes and the code moves that it's too annoying to fully review. But the commits look reasonable, it works well, and it's a great improvement; that's good enough for me.

Thank you!

@JustAnotherArchivist JustAnotherArchivist added bug enhancement dashboard Client-side dashboard only; dashboard server things should use the backend label instead. labels Jun 30, 2023
@JustAnotherArchivist JustAnotherArchivist merged commit 86e4009 into ArchiveTeam:master Jun 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug dashboard Client-side dashboard only; dashboard server things should use the backend label instead. enhancement
2 participants