mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Tweaked wording for v8 "performance cliff" issue
This commit is contained in:
+10
-7
@@ -254,14 +254,16 @@ function FiberNode(
|
||||
this.alternate = null;
|
||||
|
||||
if (enableProfilerTimer) {
|
||||
// Note: The following is done to avoid a v8 deopt.
|
||||
// Note: The following is done to avoid a v8 performance cliff.
|
||||
//
|
||||
// It is important to initialize the fields below with doubles.
|
||||
// Otherwise Fibers will deopt and end up having separate shapes when
|
||||
// doubles are later assigned to fields that initially contained smis.
|
||||
// This is a bug in v8 having something to do with Object.preventExtension().
|
||||
// Initializing the fields below to smis and later updating them with
|
||||
// double values will cause Fibers to end up having separate shapes.
|
||||
// This behavior/bug has something to do with Object.preventExtension().
|
||||
// Fortunately this only impacts DEV builds.
|
||||
// Unfortunately it makes React unusably slow for some applications.
|
||||
// To work around this, initialize the fields below with doubles.
|
||||
//
|
||||
// Learn more about this deopt here:
|
||||
// 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;
|
||||
@@ -270,7 +272,8 @@ function FiberNode(
|
||||
this.treeBaseDuration = Number.NaN;
|
||||
|
||||
// It's okay to replace the initial doubles with smis after initialization.
|
||||
// This simplifies other profiler code and doesn't trigger the deopt.
|
||||
// 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;
|
||||
|
||||
Reference in New Issue
Block a user