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: https://github.com/facebook/react-native/pull/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
This commit is contained in:
Hanno J. Gödecke authored and Facebook GitHub Bot committed 2025-07-22 04:14:48 -07:00
1 parent f84514a88b
commit bbc0c0b6ef
1 file changed
+9 -10
@@ -310,17 +310,16 @@ void PerformanceEntryReporter::traceMark(
UserTimingDetailProvider&& detailProvider) const {
auto& performanceTracer =
jsinspector_modern::tracing::PerformanceTracer::getInstance();
if (ReactPerfettoLogger::isTracing() || performanceTracer.isTracing()) {
if (ReactPerfettoLogger::isTracing()) {
ReactPerfettoLogger::mark(entry.name, entry.startTime);
}
if (performanceTracer.isTracing()) {
performanceTracer.reportMark(
entry.name,
entry.startTime,
detailProvider != nullptr ? detailProvider() : nullptr);
}
if (ReactPerfettoLogger::isTracing()) {
ReactPerfettoLogger::mark(entry.name, entry.startTime);
}
if (performanceTracer.isTracing()) {
performanceTracer.reportMark(
entry.name,
entry.startTime,
detailProvider != nullptr ? detailProvider() : nullptr);
}
}