From 09cb12c26ca8484fa20aa5e6fd63e71e60c21067 Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Sat, 24 Apr 2021 03:19:43 -0700 Subject: [PATCH] Pass eventPriority by value instead of reference Summary: Changelog: [internal] EventPriority is backed by int, passing it by reference doesn't provide any performance benefits. Quite contrary, it can make it slower because of indirectness (in our case it is probably negligible). Reviewed By: mdvacca Differential Revision: D27938600 fbshipit-source-id: 37d1312627dd5a8f9012dfb35d21afe716a16ad7 --- ReactCommon/react/renderer/core/EventEmitter.cpp | 4 ++-- ReactCommon/react/renderer/core/EventEmitter.h | 4 ++-- ReactCommon/react/renderer/core/EventPriority.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ReactCommon/react/renderer/core/EventEmitter.cpp b/ReactCommon/react/renderer/core/EventEmitter.cpp index 54a0c8154b2..7d0dac98392 100644 --- a/ReactCommon/react/renderer/core/EventEmitter.cpp +++ b/ReactCommon/react/renderer/core/EventEmitter.cpp @@ -52,7 +52,7 @@ EventEmitter::EventEmitter( void EventEmitter::dispatchEvent( const std::string &type, const folly::dynamic &payload, - const EventPriority &priority) const { + EventPriority priority) const { dispatchEvent( type, [payload](jsi::Runtime &runtime) { @@ -64,7 +64,7 @@ void EventEmitter::dispatchEvent( void EventEmitter::dispatchEvent( const std::string &type, const ValueFactory &payloadFactory, - const EventPriority &priority) const { + EventPriority priority) const { SystraceSection s("EventEmitter::dispatchEvent"); auto eventDispatcher = eventDispatcher_.lock(); diff --git a/ReactCommon/react/renderer/core/EventEmitter.h b/ReactCommon/react/renderer/core/EventEmitter.h index 55bdf8f0401..a60e7507fa7 100644 --- a/ReactCommon/react/renderer/core/EventEmitter.h +++ b/ReactCommon/react/renderer/core/EventEmitter.h @@ -71,12 +71,12 @@ class EventEmitter { const std::string &type, const ValueFactory &payloadFactory = EventEmitter::defaultPayloadFactory(), - const EventPriority &priority = EventPriority::AsynchronousBatched) const; + EventPriority priority = EventPriority::AsynchronousBatched) const; void dispatchEvent( const std::string &type, const folly::dynamic &payload, - const EventPriority &priority = EventPriority::AsynchronousBatched) const; + EventPriority priority = EventPriority::AsynchronousBatched) const; void dispatchUniqueEvent( const std::string &type, diff --git a/ReactCommon/react/renderer/core/EventPriority.h b/ReactCommon/react/renderer/core/EventPriority.h index 61e3ad39dbd..8611f105800 100644 --- a/ReactCommon/react/renderer/core/EventPriority.h +++ b/ReactCommon/react/renderer/core/EventPriority.h @@ -10,7 +10,7 @@ namespace facebook { namespace react { -enum class EventPriority : int { +enum class EventPriority { SynchronousUnbatched, SynchronousBatched, AsynchronousUnbatched,