mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Performance: avoid triggering map deopt in V8 (#28569)
The shape of the objects changed by this PR are both created in 2 locations with 2 different shapes, which most JS engines won't like. I've noticed this in particular in V8 while benchmarking production code. https://github.com/facebook/react/blob/1293047d6063f3508af15e68cca916660ded791e/packages/react-reconciler/src/ReactFiberCacheComponent.js#L66-L77 https://github.com/facebook/react/blob/1293047d6063f3508af15e68cca916660ded791e/packages/react-reconciler/src/ReactFiberHostContext.js#L47-L54 https://github.com/facebook/react/blob/1293047d6063f3508af15e68cca916660ded791e/packages/react-reconciler/src/ReactFiberHooks.js#L3530-L3531 https://github.com/facebook/react/blob/1293047d6063f3508af15e68cca916660ded791e/packages/react-reconciler/src/ReactFiberHooks.js#L3492-L3493
This commit is contained in:
+1
-1
@@ -3489,8 +3489,8 @@ export const ContextOnlyDispatcher: Dispatcher = {
|
||||
useContext: throwInvalidHookError,
|
||||
useEffect: throwInvalidHookError,
|
||||
useImperativeHandle: throwInvalidHookError,
|
||||
useInsertionEffect: throwInvalidHookError,
|
||||
useLayoutEffect: throwInvalidHookError,
|
||||
useInsertionEffect: throwInvalidHookError,
|
||||
useMemo: throwInvalidHookError,
|
||||
useReducer: throwInvalidHookError,
|
||||
useRef: throwInvalidHookError,
|
||||
|
||||
+2
-2
@@ -46,11 +46,11 @@ const hostTransitionProviderCursor: StackCursor<Fiber | null> =
|
||||
// inside useHostTransitionStatus.
|
||||
export const HostTransitionContext: ReactContext<TransitionStatus | null> = {
|
||||
$$typeof: REACT_CONTEXT_TYPE,
|
||||
Provider: (null: any),
|
||||
Consumer: (null: any),
|
||||
_currentValue: null,
|
||||
_currentValue2: null,
|
||||
_threadCount: 0,
|
||||
Provider: (null: any),
|
||||
Consumer: (null: any),
|
||||
};
|
||||
|
||||
function requiredContext<Value>(c: Value | null): Value {
|
||||
|
||||
Reference in New Issue
Block a user