Skip to content

Commit

Permalink
Disable expensive checks in OSS (#42306)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #42306

Internally, we have some computationally expensive checks in Debug mode when running Fabric.
However, these are not very useful in OSS and they were the cause of some issues which generated noise.
With this change, we are enabling those checks only in the Meta specific builds and making sure that the OSS won't incur in that cost.

## Changelog
[Internal] - Disable expensive Fabric checks when running Fabric in OSS

Reviewed By: cortinico, sammy-SC

Differential Revision: D52543696

fbshipit-source-id: 697f14fd21e884f293ea7cee8ee16fff73764996
  • Loading branch information
cipolleschi authored and facebook-github-bot committed Jan 16, 2024
1 parent 1dd6474 commit 51fd418
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ void YogaLayoutableShadowNode::ensureConsistency() const {
}

void YogaLayoutableShadowNode::ensureYogaChildrenLookFine() const {
#ifdef REACT_NATIVE_DEBUG
#if defined(REACT_NATIVE_DEBUG) && defined(WITH_FBSYSTRACE)
// Checking that the shapes of Yoga node children object look fine.
// This is the only heuristic that might produce false-positive results
// (really broken dangled nodes might look fine). This is useful as an early
Expand All @@ -997,7 +997,7 @@ void YogaLayoutableShadowNode::ensureYogaChildrenLookFine() const {
}

void YogaLayoutableShadowNode::ensureYogaChildrenAlignment() const {
#ifdef REACT_NATIVE_DEBUG
#if defined(REACT_NATIVE_DEBUG) && defined(WITH_FBSYSTRACE)
// If the node is not a leaf node, checking that:
// - All children are `YogaLayoutableShadowNode` subclasses.
// - All Yoga children are owned/connected to corresponding children of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,15 @@
// Enables some Shadow Tree introspection features (maintains a StubViewTree,
// and logs prev/next tree and mutations if there are any discrepancies). If you
// define this, also define `RN_DEBUG_STRING_CONVERTIBLE`.
#ifdef REACT_NATIVE_DEBUG
#if (defined(REACT_NATIVE_DEBUG) && defined(WITH_FBSYSTRACE))
#define RN_SHADOW_TREE_INTROSPECTION 1
#endif

// This enables certain object-to-string debug conversions to be compiled.
// Enable if `RN_SHADOW_TREE_INTROSPECTION` is enabled.
#ifdef RN_SHADOW_TREE_INTROSPECTION
#define RN_DEBUG_STRING_CONVERTIBLE 1
#endif

#ifndef RN_DEBUG_STRING_CONVERTIBLE
#else
#define RN_DEBUG_STRING_CONVERTIBLE 0
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

#if RN_DEBUG_STRING_CONVERTIBLE
#include <memory>

#include <gtest/gtest.h>
Expand Down Expand Up @@ -82,3 +83,4 @@ TEST(DebugStringConvertibleTest, handleNodeWithComplexProps) {
item->getDebugDescription().c_str(),
"<View=hello x=1(height=100 width=200)/>");
}
#endif

0 comments on commit 51fd418

Please sign in to comment.