-
Notifications
You must be signed in to change notification settings - Fork 47.6k
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
Add ProfileRoot component for collecting new time metrics #12745
Merged
Merged
Changes from 69 commits
Commits
Show all changes
72 commits
Select commit
Hold shift + click to select a range
a3b92fc
Added ProfileMode and enableProfileModeMetrics feature flag
cb2e802
Added more tests. Fixed premature bailout cases.
5af43eb
Convert ProfileMode to new, non-Mode based ProfileRoot component type
808c5e7
Renamed "profile mode" in a few places to "profile root"
65a33f9
Added some more (failing) tests
afb88c3
Updated TODO comments
e812f14
Added ReactProfileTimer. Addressed many TODOs. Most tests passing loc…
a0f3500
Don't update base time for bailouts
732ec35
Added some comments and renamed a few methods
0e86e9a
Added DEV error checking for unexpected base render timer start/stopping
4e987db
Added error handling behavior (and test)
8d86fad
Cleaned up and improved tests
1c2ae58
Added test with replayFailedUnitOfWorkWithInvokeGuardedCallback enabled
f88b562
Renamed a few tests (nits)
0942eb8
Cleaned up snapshot tests
2e1a4e3
Don't include time between frames in actual time measurements
004940c
Added addl dev checks for emtpy stack, and improved pause/resume beha…
9983cc0
Added label prop to ProfileRoot component name
91af221
Added tests for shallow renderer and toTree/findByType
9f0c4d4
Improved pause/resume time calculation to not require traversing stack
643399b
Pop ProfileRoot from timer stack on interruption
f609d87
Simplified API for timer pause/resume
899529f
Test naming nit picks
1ea1562
Removed dead code
ebc4e99
Tidied up comments and formatting a bit
909b19a
Added a test for getDerivedStateFromCatch()
2d9bc67
Reanmed ProfileRoot label attribute to id
8b44f88
Fixed test
4743d65
Added timing test coverage for lifecycles
0431206
Fixed prod bundle test with __DEV__ conditional
aabb36f
Replace unnecssary stateNode Object wrapper with number
52df41c
Renamed ProfileRoot -> Profiler
f3e0fcf
Renamed callback prop -> onRender
e4ff3d2
Renamed ReactProfileRoot-test -> ReactProfiler-test
20eff9a
Renamed snapshot
6f803d3
Moved bubbling of base times from ReactFiberCompleteWork -> ReactFibe…
3ff9121
Removed unnecessary CommitProfile effect tag in favor of Update
6c9b1e2
Bailout on Profiler if memoized and pending props are equal
081a83b
Fixed props memoization typo for Profiler component
bae55f4
Replaced onRender.call with onRender()
0a4b44d
Small tweaks based on Seb's feedback
d1c0ad1
Removed unnecessary conditionals
417c9b4
Updated ReactProfileTimer to use HostConfig now() timer
1f132db
Fixed funky stack cursor Flow typing
7ea2277
Combined expiration and base render time bubbling into one loop
13dae8b
Moved render timing check to be better colocated with uer timing check
ae8b527
Wrapped timer call in enableProfileModeMetrics conditional
305db33
Don't prevent bailout unnecessarily for Profiler component
b8782e5
Fixed Flow type for selfBaseTime and treeBaseTime in Fiber
4e54ff6
Refactored base render timer logic a bit to remove redundant check
45cd176
Reset totalElapsedPauseTime after commit (at the end of commitRoot)
283652a
Refactored actual render timer to use shared ReactFiberStack
f834d67
Removed unnecessary function call
2977521
Fixed Flow type for ReactFiber selfBaseTime/treeBaseTime
abf999d
Added an additional pause/resume test
f551e4d
Renamed ReactProfileTimer -> ReactProfilerTimer
2d909ae
Moved all timer functions inside of createProfilerTimer factory
9ad72e2
Removed ReactFiberStack from ProfilerTimer. Kept DEV only push/pop wa…
4923a9d
Removed unnecessary else conditinoal in scheduler
5e14a49
Destructured ProfilerTimer methods to avoid unnecessary property access
25fcd3a
Converted Profiler stateNode from number to wrapper Object
120a6d7
Removed source of potential false positive from test
bde491e
Added a test for change to id prop
c5e44c2
Expanded update interrupt test to be more thorough
8485467
TestRenderer unstable_flushSync returns yielded values (so you can as…
da2686d
Added a better interrupt test case
48f113c
Prettier
d55372c
Tidied up tests with more explicit flush/yield expectations and inlin…
fd731b4
Renamed getComponentName() output from ProfileMode -> Profiler
68b0553
Update snapshot
71034a7
Conditionally return from createProfilerTimer based on feature flag
e3a2562
Renamed flag enableProfileModeMetrics -> enableProfilerTiming and a f…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is wrong. We should always assign them and they should always a consistent type value. E.g. 0.
Making them optional is a huge no, no since it might break the hidden class of the fiber.
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.
I wasn't sure how to type them- given that we only assign these values if the feature flag is enabled. (We don't want to add them to every fiber if the flag isn't even enabled- right?)
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.
To be clear, they are always either on or off. It's based on the feature flag. This will not break the hidden class of a fiber, since this is a bundle-wide thing.
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.
Hm. I see. I suppose we do that with DEV only too. Seems odd that Flow doesn't force you to check for their existence everywhere then? We shouldn't need to check if they're undefined/null but seems like Flow would want us to.
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.
I agree. I expected that also.