-
Notifications
You must be signed in to change notification settings - Fork 47k
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
Record "actual" times for all Fibers within a Profiler tree (alt) #12910
Conversation
A global 'batch id' is updated during the commit phase. Each (profiled) Fiber has a local batch id. When the Profiler timer is started- the local id is compared to the global one in order to determine whether to reset or accumulate duration. This has the downside of adding an additional field to fibers (for profiling builds only) but the upside of containing the writes to 'render' phase and allowing the DevTools commit hook to run before durations have been cleared out (so it can read them for profiling mode).
This change gives up on accumulating time across renders of different priority, but in exchange- simplifies how the commit phase (reset) code works, and perhaps also makes the profiling code more compatible with future resuming behavior
// This prevents time from endlessly accumulating in new commits. | ||
workInProgress.actualDuration = 0; | ||
workInProgress.actualStartTime = 0; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These can be moved to the else
block above. For the initial clone, these are already 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, although I'll have to break this up so that selfBaseTime
and treeBaseTime
get copied in both cases. No problem though!
Details of bundled changes.Comparing: 76e0707...edc7a5d react-dom
react-art
react-test-renderer
react-reconciler
react-native-renderer
Generated by 🚫 dangerJS |
Alternate implementation of PR #12891
Trades the ability to accumulate "actual" time across renders of different priorities in exchange for simplifying how/when we need to reset times. Theoretically, this approach is also more compatible with future resuming behavior.