Rename ReactPerf methods to match the upcoming ReactPerf revamp #6287
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.
I’m not feeling strong about this but I would like to get these two methods renamed before 15.0.
printDOM()
→printOperations()
printDOM()
is really popular one but sinceReactPerf
can be used together with React Native, the name doesn’t really do it justice. In #6046, we let renderers emit arbitraryNATIVE_OPERATION
events so React Native won’t be confined to the current list of “DOM operations” either. This is why I’m renamingprintDOM()
toprintOperations()
.getMeasurementsSummaryMap()
→getWasted()
The second rename concerns
getMeasurementsSummaryMap()
which was added in #2219. Its name is already somewhat confusing because it doesn’t actually return a map—it returns an array. Additionally, it sounds very generic but it actually corresponds to a very specific dataset: the table printed byprintWasted()
.In #6046 I plan to expose a
get*
method for everyprint*
method so it makes sense thatgetWasted()
exists as a match toprintWasted()
in 15.0, complemented by otherget*()
methods such asgetInclusive()
andgetOperations()
when #6046 ships some time during 15.x.One thing I’m not sure about is whether
getWasted()
invites an unnecessary connotation for fluent English speakers. I’m open to improvements that offer another way of maintaining consistency with the upcoming changes, e.g.getWastedStats()
,getInclusiveStats()
, etc.Why Do This Now
This is our opportunity to rename some methods on the API that’s going to significantly change internally, and I think it’s worth doing it before shipping 15.0. Since people rely on
getMeasurementsSummaryMap()
for things like CI (#2219), in my opinion it would be unwise to introduce a deprecation warning in something other than a major release, as a new warning can potentially break CIs.Deprecation Strategy
We will keep the old method name working in v15 with a deprecation warning, and remove it during or after v16 when most tutorials have been updated.
Reviewers
@sebmarkbage @jimfb