Skip to content

Commit 1dc108e

Browse files
author
Brian Vaughn
committed
Tweaked wording for v8 "performance cliff" issue
1 parent d987172 commit 1dc108e

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

packages/react-reconciler/src/ReactFiber.js

+10-7
Original file line numberDiff line numberDiff line change
@@ -254,14 +254,16 @@ function FiberNode(
254254
this.alternate = null;
255255

256256
if (enableProfilerTimer) {
257-
// Note: The following is done to avoid a v8 deopt.
257+
// Note: The following is done to avoid a v8 performance cliff.
258258
//
259-
// It is important to initialize the fields below with doubles.
260-
// Otherwise Fibers will deopt and end up having separate shapes when
261-
// doubles are later assigned to fields that initially contained smis.
262-
// This is a bug in v8 having something to do with Object.preventExtension().
259+
// Initializing the fields below to smis and later updating them with
260+
// double values will cause Fibers to end up having separate shapes.
261+
// This behavior/bug has something to do with Object.preventExtension().
262+
// Fortunately this only impacts DEV builds.
263+
// Unfortunately it makes React unusably slow for some applications.
264+
// To work around this, initialize the fields below with doubles.
263265
//
264-
// Learn more about this deopt here:
266+
// Learn more about this here:
265267
// https://github.com/facebook/react/issues/14365
266268
// https://bugs.chromium.org/p/v8/issues/detail?id=8538
267269
this.actualDuration = Number.NaN;
@@ -270,7 +272,8 @@ function FiberNode(
270272
this.treeBaseDuration = Number.NaN;
271273

272274
// It's okay to replace the initial doubles with smis after initialization.
273-
// This simplifies other profiler code and doesn't trigger the deopt.
275+
// This won't trigger the performance cliff mentioned above,
276+
// and it simplifies other profiler code (including DevTools).
274277
this.actualDuration = 0;
275278
this.actualStartTime = -1;
276279
this.selfBaseDuration = 0;

0 commit comments

Comments
 (0)