-
Notifications
You must be signed in to change notification settings - Fork 50k
Record "actual" times for all Fibers within a Profiler tree #12891
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
Conversation
|
There's still an open question about how DevTools can read this info before it's reset. Currently the Maybe we can change React to call the DevTools Edit Resolved by commit a34c8a8 |
|
I've realized there is a pretty big flaw with the way I'm resetting (or more accurately not resetting) actual time durations on non- Essentially, fibers that don't get flagged with an update effect won't be processed during commit in a way that enables us to reset their timers, and I don't want to introduce something expensive to the "commit" phase (e.g. introducing a new commit effect type, traversing the tree) to fix this. The best way of doing this that I have thought of is to use a (global) commit batch identifier that's updated once during the commit phase. Each (profiled) fiber has a batch ID as well, and when actual time is started- this ID is checked 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 also addressing the DevTools limitations above. Edit Proposed change added in commit a34c8a8 |
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).
Details of bundled changes.Comparing: 76e0707...05fa464 react-dom
react-art
react-test-renderer
react-reconciler
react-native-renderer
Generated by 🚫 dangerJS |
68501a2 to
3c03bb3
Compare
|
Closing in favor of PR #12910 |
Move "actual" time tracking attributes onto the
Fiberobject and track for everyFiberwithin aProfilertree. This change is being made so that DevTools has the ability to display timing info for all components in an application (or a subtree) simply by flipping the rootFiberand its alternate toProfileMode.This change should have no impact on the production bundle since the newly added fields are stripped out if
enableProfilerTimeris disabled. It should have minimal impact on the dev and production profiling bundles since measurements are only recorded ifProfileModeis active.Checklist
Bundle sizes
Built after rebasing on master:
