Coder Social home page Coder Social logo

Comments (6)

conceptualspace avatar conceptualspace commented on June 15, 2024

that's odd, will try to reproduce. typically the only thing yasd does that could be considered cpu intensive is when you upload a custom image as a thumbnail, it resizes the image. but that would only be a transient spike (happens in milliseconds) not continuous. what version of chrome and yasd are you running exactly?

from yet-another-speed-dial.

Darthagnon avatar Darthagnon commented on June 15, 2024

Here's a screenshot, showing typical behaviour (its CPU usage seems to cycle up and down every few seconds)

I'm using M$ Edgium 84.0.522.5 (Official build) dev (64-bit) (latest dev version); latest version of YASD from the Chrome Web Store. Identical behaviour observed in old Ungoogled Chromium v70, and in an older build of Edgium from a few weeks ago, when I first tried the extension.

from yet-another-speed-dial.

conceptualspace avatar conceptualspace commented on June 15, 2024

got it. should only occur when the tab is in focus, right? background tab usage goes to 0?

it's likely result of the animation ticker. this allows the speed dials to animate smoothly when certain events occur, like resizing the window or dragging a tile. it runs on spare cpu cycles so shouldn't be considered expensive, but it keeps everything a buttery 60fps.

Technical explanation:

"The ticker is driven by requestAnimationFrame events in modern browsers so that the updates are perfectly synchronized with the browser's rendering cycle. It also means that when the user switches to a different tab in the browser, the ticker's updates get throttled back significantly in order to conserve battery power and reduce load on the CPU (this happens because the browser itself throttles back requestAnimationFrame event dispatching). Typically requestAnimationFrame events occur around 60 times per second, but that's up to the browser and depends on system performance as well. If requestAnimationFrame isn't supported, the ticker automatically falls back to using a regular setTimeout() loop which is supported in all browsers."

hope that answers your questions. the relevant piece of code is the animate function in index.js. cheers

from yet-another-speed-dial.

conceptualspace avatar conceptualspace commented on June 15, 2024

just noting for posterity: actual cpu usage on my test system with an active yasd tab open is < 1%

from yet-another-speed-dial.

Darthagnon avatar Darthagnon commented on June 15, 2024

Toolbar Dial has 0% CPU usage in the browser task manager whether focused or unfocused - it's a similar extension with a few more features; perhaps the code might provide some ideas? I tested YASD again, it was 0% as long as not in focus. As soon as a YASD tab was in focus, in-browser task manager reported CPU jumping between 9%-14% (NB this does not translate directly to real Task Manager CPU usage; browser task manager seems to apply a scaling factor, perhaps as a percentage of the CPU used by the browser?)

from yet-another-speed-dial.

conceptualspace avatar conceptualspace commented on June 15, 2024

replaced the ticker with more efficient code in 16f005a

the usage will never be truly 0 because YASD animates the dials on window resizing; so it has to know when such resizing occurs. but the cost is very low

from yet-another-speed-dial.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.