Skip to content

Commit bbc0c0b

Browse files
hannojgfacebook-github-bot
authored andcommitted
fix: remove redundant if checks in traceMark (#52756)
Summary: There are some duplicated function calls in `PerformanceEntryReporter::reportMark()` . I know this is a micro optimization but I feel this way the code is cleaner. This is called through `performance.mark` so there is potentially a tiny little performance improvement here? ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [INTERNAL] [FIXED] - Removed redundant checks in `PerformanceEntryReporter::reportMark()` Pull Request resolved: #52756 Test Plan: The existing testing infrastructure should cover these callsites i believe Reviewed By: rubennorte Differential Revision: D78731441 Pulled By: cortinico fbshipit-source-id: e0de12c3c6f55e12eb454ea4b7081f3d6003126c
1 parent f84514a commit bbc0c0b

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

packages/react-native/ReactCommon/react/performance/timeline/PerformanceEntryReporter.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -310,17 +310,16 @@ void PerformanceEntryReporter::traceMark(
310310
UserTimingDetailProvider&& detailProvider) const {
311311
auto& performanceTracer =
312312
jsinspector_modern::tracing::PerformanceTracer::getInstance();
313-
if (ReactPerfettoLogger::isTracing() || performanceTracer.isTracing()) {
314-
if (ReactPerfettoLogger::isTracing()) {
315-
ReactPerfettoLogger::mark(entry.name, entry.startTime);
316-
}
317313

318-
if (performanceTracer.isTracing()) {
319-
performanceTracer.reportMark(
320-
entry.name,
321-
entry.startTime,
322-
detailProvider != nullptr ? detailProvider() : nullptr);
323-
}
314+
if (ReactPerfettoLogger::isTracing()) {
315+
ReactPerfettoLogger::mark(entry.name, entry.startTime);
316+
}
317+
318+
if (performanceTracer.isTracing()) {
319+
performanceTracer.reportMark(
320+
entry.name,
321+
entry.startTime,
322+
detailProvider != nullptr ? detailProvider() : nullptr);
324323
}
325324
}
326325

0 commit comments

Comments
 (0)