diff --git a/packages/react-reconciler/src/ReactFiber.js b/packages/react-reconciler/src/ReactFiber.js index 4147f0d04e9..29a8931038c 100644 --- a/packages/react-reconciler/src/ReactFiber.js +++ b/packages/react-reconciler/src/ReactFiber.js @@ -187,18 +187,11 @@ function FiberNode( // Learn more about this here: // https://github.com/facebook/react/issues/14365 // https://bugs.chromium.org/p/v8/issues/detail?id=8538 - this.actualDuration = Number.NaN; - this.actualStartTime = Number.NaN; - this.selfBaseDuration = Number.NaN; - this.treeBaseDuration = Number.NaN; - - // It's okay to replace the initial doubles with smis after initialization. - // This won't trigger the performance cliff mentioned above, - // and it simplifies other profiler code (including DevTools). - this.actualDuration = 0; - this.actualStartTime = -1; - this.selfBaseDuration = 0; - this.treeBaseDuration = 0; + + this.actualDuration = -0; + this.actualStartTime = -1.1; + this.selfBaseDuration = -0; + this.treeBaseDuration = -0; } if (__DEV__) { @@ -286,10 +279,10 @@ function createFiberImplObject( }; if (enableProfilerTimer) { - fiber.actualDuration = 0; - fiber.actualStartTime = -1; - fiber.selfBaseDuration = 0; - fiber.treeBaseDuration = 0; + fiber.actualDuration = -0; + fiber.actualStartTime = -1.1; + fiber.selfBaseDuration = -0; + fiber.treeBaseDuration = -0; } if (__DEV__) { @@ -382,8 +375,8 @@ export function createWorkInProgress(current: Fiber, pendingProps: any): Fiber { // This prevents time from endlessly accumulating in new commits. // This has the downside of resetting values for different priority renders, // But works for yielding (the common case) and should support resuming. - workInProgress.actualDuration = 0; - workInProgress.actualStartTime = -1; + workInProgress.actualDuration = -0; + workInProgress.actualStartTime = -1.1; } } diff --git a/packages/react-reconciler/src/ReactFiberBeginWork.js b/packages/react-reconciler/src/ReactFiberBeginWork.js index 34176bb83b5..c71b7044756 100644 --- a/packages/react-reconciler/src/ReactFiberBeginWork.js +++ b/packages/react-reconciler/src/ReactFiberBeginWork.js @@ -2430,10 +2430,10 @@ function mountSuspenseFallbackChildren( // final amounts. This seems counterintuitive, since we're intentionally // not measuring part of the render phase, but this makes it match what we // do in Concurrent Mode. - primaryChildFragment.actualDuration = 0; - primaryChildFragment.actualStartTime = -1; - primaryChildFragment.selfBaseDuration = 0; - primaryChildFragment.treeBaseDuration = 0; + primaryChildFragment.actualDuration = -0; + primaryChildFragment.actualStartTime = -1.1; + primaryChildFragment.selfBaseDuration = -0; + primaryChildFragment.treeBaseDuration = -0; } fallbackChildFragment = createFiberFromFragment( @@ -2560,8 +2560,8 @@ function updateSuspenseFallbackChildren( // final amounts. This seems counterintuitive, since we're intentionally // not measuring part of the render phase, but this makes it match what we // do in Concurrent Mode. - primaryChildFragment.actualDuration = 0; - primaryChildFragment.actualStartTime = -1; + primaryChildFragment.actualDuration = -0; + primaryChildFragment.actualStartTime = -1.1; primaryChildFragment.selfBaseDuration = currentPrimaryChildFragment.selfBaseDuration; primaryChildFragment.treeBaseDuration =