studio-perf
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseStudio Performance
Studio 性能
Minimize frame subscriptions
减少帧订阅
Keep dependencies on the current frame as low in the component tree as possible.
Prefer imperative timeline state reads such as over
for event handlers and other
on-demand logic.
getCurrentFrame()Internals.Timeline.useTimelinePosition()Use only in the smallest leaf component whose rendered
output must change with the frame. If a parent reads the frame only to pass it
to a child, extract a frame-subscribing child so the parent and its other
descendants stay stable.
useTimelinePosition()尽量让组件树中依赖当前帧的层级下沉。
对于事件处理程序和其他按需逻辑,优先使用 等命令式时间轴状态读取方式,而不是 。
getCurrentFrame()Internals.Timeline.useTimelinePosition()仅在输出结果必须随帧变化的最小叶子组件中使用 。如果父组件读取当前帧只是为了将其传递给子组件,请提取一个订阅帧状态的子组件,使父组件及其其他后代组件保持稳定。
useTimelinePosition()Memoize stable boundaries
记忆化稳定边界
Wrap components in when they can safely skip parent-driven
renders. Confirm that their props remain referentially stable across frame
updates: newly created objects, callbacks, styles, or React nodes defeat shallow
memoization. Stabilize those props only where it is natural; avoid custom
comparators that ignore behaviorally relevant changes.
React.memo()Context subscribers continue to update through memoized ancestors. Prefer a
memoized stable parent with a small frame-subscribing leaf over making the whole
subtree reactive to the current frame.
当组件可以安全跳过父组件触发的渲染时,使用 包裹组件。确认其 props 在帧更新期间始终保持引用稳定:新创建的对象、回调、样式或 React 节点都会破坏浅比较记忆化。仅在自然且合适的位置稳定这些 props;避免使用会忽略行为相关变化的自定义 comparator。
React.memo()Context 订阅者仍会通过已记忆化的祖先组件继续更新。优先使用带有小型帧订阅叶子组件的已记忆化稳定父组件,而不是让整个子树对当前帧作出响应。