GithubHelp home page GithubHelp logo

Comments (4)

ScriptedAlchemy avatar ScriptedAlchemy commented on June 28, 2024

Wild idea, but would is be possible to do something like extend the delay adaptively? RIC does this but it's often too fast.

I've used algorithms that are able to calculate current CPU pressure. I mainly do this so I can block third party tags by monkey patching document.createElement. Then based of CPU pressure I can suspend the unblock rates till CPU isn't under so much stress.

Another one that might be interesting to consider is suspending when the user interacts with the page, scrolling or clicking around - tho some of this might be covered by by requestAnimationFrame

from main-thread-scheduling.

astoilkov avatar astoilkov commented on June 28, 2024

Wild idea, but would is be possible to do something like extend the delay adaptively?

I like the idea. Maybe I can use it as a fallback when navigator.scheduling.isInputPending() isn't available. Do you have examples of a code that tries to do that? I will be interested in learning from it.

Another one that might be interesting to consider is suspending when the user interacts with the page, scrolling or clicking around - tho some of this might be covered by requestAnimationFrame

This is covered by navigator.scheduling.isInputPending() when available. When not available the library is a lot more conservative to do work without giving back control to userland.

from main-thread-scheduling.

astoilkov avatar astoilkov commented on June 28, 2024

Wild idea, but would is be possible to do something like extend the delay adaptively?

I started experimenting with this. We will see how it goes.

I've used algorithms that are able to calculate current CPU pressure. I mainly do this so I can block third party tags by monkey patching document.createElement. Then based of CPU pressure I can suspend the unblock rates till CPU isn't under so much stress.

Is some part of that open-source? I would love to take inspiration.

from main-thread-scheduling.

astoilkov avatar astoilkov commented on June 28, 2024

My current idea is to use fps tracking: https://github.com/astoilkov/main-thread-scheduling/blob/980ad69b477779ff882eac16ac7cd2a60331e16c/playground/utils/fps.ts. If fps is low, I will spend less time in scheduled tasks. I will add an option to the yield methods where you can control the wiggle room in ms. What do you think @ScriptedAlchemy?

from main-thread-scheduling.

Related Issues (14)

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.