GoogleChrome / GoogleChrome/lighthouse

Take into account `scheduler.yield()`

Open
#16,183 2 comments 0 reactions 1 assignee Assigned to @connorjclark View on GitHub
P2
Dominant language
JavaScript
Stars
30.8k
Forks
9.8k
Avg merge
1d 20h
Merged PRs (30d)
19

Description

[scheduler.yield()](https://developer.chrome.com/blog/introducing-scheduler-yield-origin-trial) is here.

AFAIU, this is a better version of `navigator.scheduling.isInputPending()` (which LH also does not handle https://github.com/GoogleChrome/lighthouse/issues/11747).

We can handle this pretty simply, I think:

1. Emit a trace event when `await scheduler.yield()` happens
2. When simulating long tasks for mobile, use these trace events as the bounds for "synthetic" tasks, and check if those are larger than the long task threshold rather than the original-task-multiplied-by-cpu-throttling

This should fairly reduce TBT for pages that properly use `scheduler.yield`.

We may wish to prioritize this in order to give people trying this new feature out in Origin Trials, and using Lighthouse to help evaluate its impact, will get a good representation of its effectiveness.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.