-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Steps
- Add a
enableSchedulingProfilerfeature flag. - Add user timing marks and measures wherever
DebugTracingis used. Follow the prototype DataTracing User Timing API calls. - Add tests similar to the ones for
DebugTracing
Unknowns
To Research
-
What effect does the reconciler/scheduler priorities actually have? If tasks are executed in the order of priority, where is this ordering/switching happening?Reconciler schedules work usingScheduler.unstable_scheduleCallback, which registers work in a scheduling min heap. The scheduler will thus perform work based on the works' expiration dates, which are computed from the work's priority. There are also other ways to make the scheduler execute something immediately. -
How do the fiber lanes workLanesbitmask stores the lanes that React is working on. >1 lane can be worked on at any one time, i.e. the lanes are "entangled", meaning that they have a dependency on each other.
Blocked, need Brian
-
Is there existing code that generates the user timing stuff? Sounds like there is, since there's test data.Yes. Some of the user timing calls are in facebook/react@master...bvaughn:root-event-marks. Others were in React but removed in Remove Calls to User Timing API facebook/react#18417. -
What priorities are we using? The profiler POC and React's reconciler/scheduler have different priorities.Scheduler priorities, translated to labels in the profiler by priorityLevelToLabel. Fiber lane priorities can be translated to scheduler priorities with lanePriorityToSchedulerPriority. -
Will the new fiber lanes affect the priorities?DebugTracingremoved in Temporarily Remove DebugTracing from the New Reconciler facebook/react#18697, with a note saying that "Priority field on update isn't useful anymore since the lanes convey more info". The DebugTracing functions are called with priority either retrieved fromgetCurrentPriorityLevelor have a priority level passed to it. These can still be used in the fiber lane reconciler. However,log(Force|State)UpdateScheduledfunctions are called using priority levels retrieved frominferPriorityFromExpirationTime, which has no analog in the lane implementation. Questions:-
Why can't thelog*UpdateScheduledcallers also use the priority levels fromgetCurrentPriorityLevel? -
If we can't, what should we do? Is there a way to compute aLane'sLanePriority?lanePriorityToSchedulerPrioritycan then convert them to scheduler priorities.
We will use lanes instead of priorities.
-
-
In the same PR, "Some of the concepts are changing" -- is there anything else that will affect our profiler?We'll use lanes instead of priorities, so we will display 31 lanes instead of 4 priority rows. -
Should we add the DebugTracing code to the new lane reconciler first, since it's already replaced the old expiration time design in master?Done in Re-enabled DebugTracing feature for old reconciler fork facebook/react#19142 -
Brian mentioned in the video that "new React implementation... can have multiple cooperative chunks of work per lane". Is this the new lane reconciler that Andrew is working on? If so, this sounds like we need to record the lanes the work is scheduled on instead of (or together with?) the work's React priority.No, this sounds more like the scheduler package. -
Eng culture: would the React team prefer us to split this into a stack of individual PRs like FB's internal Diffs, or would you rather us implement a complete feature in one PR? Seems like the latter is preferred based on past React PRs, but I wanted to make sure.
-
Nonblocker, but for understanding: Brian mentioned in the onboarding video that the unscheduled priority lane has things that were "scheduled outside of the scheduler API". How does that happen in a React app?
Acceptance criteria
- If
enableSchedulingProfileris true:- User event marks should be generated, following facebook/react@master...bvaughn:root-event-marks (ignoring
renderAbandonedasDebugTracingdoes not have that).
- User event marks should be generated, following facebook/react@master...bvaughn:root-event-marks (ignoring
- Else no change to existing behavior.
Tests should be written.
References
- Project description https://github.com/MLH-Fellowship/0.4.x-projects/wiki/React-Concurrent-Mode-Profiler
- DebugTracing logger PR Add experimental DebugTracing logger for internal use facebook/react#18531
- DebugTracing prototype facebook/react@master...bvaughn:root-event-marks
- Updated DebugTracing for "lanes" PR Re-enabled DebugTracing feature for old reconciler fork facebook/react#19142