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

Can scheduler.yield() return additional information? #108

Open
marco-prontera opened this issue Sep 19, 2024 · 4 comments
Open

Can scheduler.yield() return additional information? #108

marco-prontera opened this issue Sep 19, 2024 · 4 comments

Comments

@marco-prontera
Copy link

I'm speaking to you as a third-party developer creating scripts that run on a wide variety of websites. I'm currently at a stage where I need to gather detailed performance data. The more information I can collect, the more specific and valuable recommendations I can provide to my customers.

In particular, I'd like to better understand what happens between the moment a scheduler.yield() call is made and when execution resumes. While I can already measure the duration of this pause, I want to go further by identifying what happens during that time. This could offer insights into optimizing specific parts of a website and its integrations.

Since third-party scripts run on various websites where we don't have prior knowledge of their implementation, I believe we share common goals:

  • Minimize the impact of third-party scripts on each website.
  • Maximize the performance of third-party scripts, especially given that some parts are tied to the complex ecosystem of online advertising.

By understanding the actions that take place during the pause created by scheduler.yield(), I believe I can significantly improve how the product interacts with different websites and enhance overall performance and integration efficiency.

@mmocny
Copy link
Collaborator

mmocny commented Sep 19, 2024

Are you aware of the Long Animation Frames (LoAF) api (spec)?

It already does "long script monitoring" whenever:

  • The script takes more than 5ms, and
  • Run within an animation frame that collectively takes more than 50ms.
  • Provides attribution details about such script, and the animation frame timing

@marco-prontera
Copy link
Author

Can I use it to precisely detect what happens, even if there isn't a LoAF, from the point of the yield call until my code resumes execution?

@shaseley
Copy link
Collaborator

Tracing of some sort seems like it would be helpful. Could you maybe use the JS Self-Profiling API to collect traces during this period? (The availability is currently limited to Chromium-based browsers).

@marco-prontera
Copy link
Author

I'll try to use the JS Self-Profiling API, I'll update you as soon as I can. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants