-
-
Notifications
You must be signed in to change notification settings - Fork 133
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
Playing Icon consumes a lot of CPU #767
Comments
This is really interesting. I have been curious to improve the browser app performance of Iris so that it can run more smoothly on lower-powered devices (like a Rpi for instance). How did you determine that the animation was the cause of CPU usage? What was your testing routine? I'm keen to reproduce your results to explore the options in more depth. |
The discovery was somewhat by accident, I was using VNC to access a machine remotely and was wondering what the source of the mouse lag was. Testing is pretty rudimentary, open task manager and navigate between the now playing or the search page. On an 11th gen i7 machine, chrome (or firefox actually) uses about ~1% on the search screen and ~5% on the now playing screen along with 10-12% of the GPU. The effect seems to be greatly exaggerated the less powerful the machine is too. If you pause the music you can immediately see the resource usage drop as well, despite the computer not actually being involved in any audio playback directly. When I suspected it could be that animated green bar icon I did some digging with the browsers dev console. Inspecting the element showed that it was animated by using JS/CSS to change the size of the elements rapidly instead of using a multi-frame gif image. I suspect the code driving this animation has much more overhead than expected. |
Thanks for that info, I'll have a crack at replicating it and removing to animation to compare performance. I did have an initial trial (by just removing the element entirely) with no noted change. I had creates this using CSS transitions, which are designed to be performant and use the GPU (separate thread?) instead. One factor to consider is one element that I DO know is heavy: parallax. This is used on the artist and now playing screens. Did you, per chance, happen to compare usage with the artist page? While the parallax also uses GPU and |
I finally got around to checking the other pages, and yes the artist page consumes nearly 50% cpu on this older macbook. |
I can confirm this issue. Here's a quick and dirty benchmark, on a Linux machine (only the browser runs in this machine, mopidy runs in a separate server): Now playing page, Firefox:
Now playing page, Chrome:
Maybe the GPU acceleration is not working on my machine? In any case I'd certainly prefer an animated gif, it's a huge difference for such a tiny UI detail. |
Interestingly, I just noticed that spotify's own web UI simply uses the following animated gif for the "green bars" 😄 https://open.scdn.co/cdn/images/equaliser-animated-green.f93a2ef4.gif |
* Logging when applying preconfiguration * Exposing snapcast_ssl to config * Adding loading message to handle load issues * Refactoring App to functional component, to run pre-ready actions (preconfiguration, etc) * Removing surplus props * Update entrypoint.sh * Update entrypoint.sh * Update french translation * Remove unneeded translations * Update french translation (part 2) * Removing animation from Parallax, potential (but unlikely) performance kick, jaedb#767 * Using album_type for filtering type, fixes jaedb#788 * Restructuring and functional component-ifying * Adding verify_certificates config to disable cert validation for internal certs, fixes jaedb#778 * Constructor, not method call * Removing additional backends, now that they can be added using PIP_PACKAGES env var * Lint fixing double-space * Example of additional pip packages via environment vars * Actual test for base App (shallow render only, for now) * Housekeeping * Upgrading to more functional components * useHistory * Ditching load_queue flags, instead using simple loading prop on item itself (less capable but greater performance and predictability) and fixes jaedb#774 * Nesting Switches and subviews * All modals using dedicated /modal URL for routing * Tracklist 'source' to contain all the meta we need for queue (avoids unnecessary remote lookups) * Radio added_from stores seeds, rather than building concatenated URI * Buildout * formatSimpleObject as our source; updating context menus * More formatSimpleObjects * Correctly fetching type (may need to split source vs items) * Rebuilding context menu items (WIP) * Context consistency, formatContext, context playlist submenu * More context menu items; Callbacks for love/library toggles * Slim progress bar for mobile; production buildout * Refactoring selection, now TrackList state-managed * Adding enqueuing and shuffle-add; Correctly adding 'from' for playlist and album context menu actions' * Tracks context detect common provider; useTimer hook for state-accessible intervals/timers * Usin vanilla HTML drag * Update nl.yaml Donkder to Donker * Hooking dropzones * React DnD as provider working pretty well, still WIP * Context menu on queue 'Play next' just moves tracks; Starting touch-support for dragging * Adding touch backend, works awesome, viable candidate as primary backend * Both touch and HTML5 draggers depending on device, prevents nasty mouse experience * Removing dragger; Fixing play_next by upgrading action payload to object - easier to read * Disable dragability fully unless can_sort, prevents impossible scrolling on touch devices * Using mopidy-spotify from apt so it manages all system deps, fixes jaedb#797 * Custom context menu provides its own components * Enqueue full album/artist/playlist working (but unloaded tracks, not yet); Fixing kiosk playback position * Drag and drop for grid items, need better support for ref objects (eg playlist with no tracks loaded) * Proper checks for snapcast_enabled (and spotify_enabled) before adding event hooks; fixes jaedb#790 * Drag and drop ready to go; Context menu not perfect, but better than current * Use full playlist as context when fetching its tracks, for future callbacks * Buildout * Standard import for state; Updating GridItem which needs support for useDrag hook (render only, not actual dnd UX tests) * Removing Array test, failing since upgrading to Functional component, well, coz it now returns a function * Buildout 3.61.0 * Bump nanoid from 3.1.23 to 3.2.0 Bumps [nanoid](https://github.com/ai/nanoid) from 3.1.23 to 3.2.0. - [Release notes](https://github.com/ai/nanoid/releases) - [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md) - [Commits](ai/nanoid@3.1.23...3.2.0) --- updated-dependencies: - dependency-name: nanoid dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> * Bump path-parse from 1.0.6 to 1.0.7 Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7. - [Release notes](https://github.com/jbgutierrez/path-parse/releases) - [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7) --- updated-dependencies: - dependency-name: path-parse dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> * Bump follow-redirects from 1.11.0 to 1.14.7 Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.11.0 to 1.14.7. - [Release notes](https://github.com/follow-redirects/follow-redirects/releases) - [Commits](follow-redirects/follow-redirects@v1.11.0...v1.14.7) --- updated-dependencies: - dependency-name: follow-redirects dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> * Bump tmpl from 1.0.4 to 1.0.5 Bumps [tmpl](https://github.com/daaku/nodejs-tmpl) from 1.0.4 to 1.0.5. - [Release notes](https://github.com/daaku/nodejs-tmpl/releases) - [Commits](https://github.com/daaku/nodejs-tmpl/commits/v1.0.5) --- updated-dependencies: - dependency-name: tmpl dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> * Bump url-parse from 1.5.1 to 1.5.4 Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.5.1 to 1.5.4. - [Release notes](https://github.com/unshiftio/url-parse/releases) - [Commits](unshiftio/url-parse@1.5.1...1.5.4) --- updated-dependencies: - dependency-name: url-parse dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> * Bump ws from 6.2.1 to 6.2.2 Bumps [ws](https://github.com/websockets/ws) from 6.2.1 to 6.2.2. - [Release notes](https://github.com/websockets/ws/releases) - [Commits](websockets/ws@6.2.1...6.2.2) --- updated-dependencies: - dependency-name: ws dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> * Create codeql-analysis.yml * Bump dns-packet from 1.3.1 to 1.3.4 Bumps [dns-packet](https://github.com/mafintosh/dns-packet) from 1.3.1 to 1.3.4. - [Release notes](https://github.com/mafintosh/dns-packet/releases) - [Changelog](https://github.com/mafintosh/dns-packet/blob/master/CHANGELOG.md) - [Commits](mafintosh/dns-packet@v1.3.1...v1.3.4) --- updated-dependencies: - dependency-name: dns-packet dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> * Security patches, buildout 3.61.1 * Error boundary wrapping for breakpoints, addresses jaedb#806 * Fallback value when no uri provided, properly fixes jaedb#806 * Bump follow-redirects from 1.14.7 to 1.14.8 Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.7 to 1.14.8. - [Release notes](https://github.com/follow-redirects/follow-redirects/releases) - [Commits](follow-redirects/follow-redirects@v1.14.7...v1.14.8) --- updated-dependencies: - dependency-name: follow-redirects dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> * Safe navigating spotify settings * Play/pause snapcast streams using meta_mpd.py plugin * Merging common events * Bump url-parse from 1.5.4 to 1.5.10 Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.5.4 to 1.5.10. - [Release notes](https://github.com/unshiftio/url-parse/releases) - [Commits](unshiftio/url-parse@1.5.4...1.5.10) --- updated-dependencies: - dependency-name: url-parse dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> * Delete snapcast client; Hide whole group if all clients within it are disconnected and hidden * Make sure state has clients before trying to render them, may be cause of jaedb#806 * Using real-world examples (Linux host) * Ignoring docker_secondary for testing multi-room environments * Reinstating ID tag for CSS heirarchy, fixes jaedb#815 * Correcting negative margins for mobile * Playback progress now far bottom, prevents visual clash with volume bars (of different widths) * Docker example using mpd_meta.py * Buildout v3.62.0 Co-authored-by: James Barnsley <james@barnsley.nz> Co-authored-by: Bas van Boven <bas@basvanboven.nl> Co-authored-by: Matthias Meulien <orontee@gmail.com> Co-authored-by: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@jaedb I've been having intermittent issues with my laptop for the past several weeks that I've finally tracked down to CPU & GPU usage in Iris, specifically I've noticed on the Now Playing and Artist page (Spotify only?), but only when a track is playing. My system specs:
Reproduction steps:
|
Just with some quick tinkering in a web inspector, I can confirm the parallax doesn't seem to matter much, it's the CSS animation on the playing bars that seems to be responsible for the usage. Initially I found that the animation was layered with the parallax and thought that might be the cause, but removing the parallax layer entirely doesn't seem to change any and I didn't find any good reason for that CSS animation to result in such load. Spotify's web player uses this animated GIF when the window is focused and replaces it with a static image when the page loses focus. With the Spotify player active and focused, Spotify process CPU usage is about 10% while GPU usage is < 5%. |
Describe the bug
The playing icon for the active track (animated green bars) consumes a noticeable amount of CPU when visible in a browser.
The older mac consumed 60% of the cpu and the newer windows machine required 10% of the cpu to display this graphic.
To Reproduce
Tested on a Mid 2014 MacBook Pro and an 8th gen Core i7 windows 10 machine, both using latest chrome.
Expected behavior
Animated icon should not consume that much resources.
Console log
N/A
Screenshots
N/A
Environment details:
Additional context
Bars appear to be animated using CSS/JS. An animated gif would use much less resources.
The text was updated successfully, but these errors were encountered: