简体   繁体   English

条形宽度在反应分析器中没有意义

[英]Bar widths don't make sense in react profiler

I was looking at react profiler which seems a really nice tool.我在看反应分析器,这似乎是一个非常好的工具。 Have a look at these two screens:看看这两个屏幕:

在此处输入图像描述

and

在此处输入图像描述

What confuses me is following.让我感到困惑的是以下。 Look at the width of the div from first screenshot on which the left top corner of the tooltip starts (which says in total that component took 17.7 ms to render), now look at width of the Row on second screenshot (tooltip of which says in total that component took 12.9 ms to render).从工具提示的左上角开始的第一个屏幕截图中查看div的宽度(这表明该组件总共花费了 17.7 毫秒来渲染),现在查看第二个屏幕截图上Row的宽度(其中的工具提示在该组件总共花费了 12.9 毫秒来渲染)。 Why is the width of Row larger than the width of div left to it?为什么Row的宽度大于div左边的宽度? When div in total took more time to render?什么时候div总共需要更多时间来渲染? According to the docs, should not it be other way around?根据文档,不应该是其他方式吗? Am I missing something?我错过了什么吗?

Each bar in the flame graph needs to be wide enough to contain all of its children- even the ones that weren't even rendered in the current commit (the gray subtree starting with TextField in your screenshot above).火焰图中的每个条都需要足够宽以包含它的所有子项——甚至是那些甚至没有在当前提交中呈现的子项(上面屏幕截图中以TextField开头的灰色子树)。 that's why Row is wider than div .这就是为什么Rowdiv更宽。 The width of each node gives you some idea of what the overall cost of that subtree would be if it were all to be rendered.每个节点的宽度让您了解如果全部渲染该子树的总成本是多少。 In this case, and most cases, color is the more important bit of information .在这种情况下,以及大多数情况下,颜色是更重要的信息

This note in the React Profiler docs mentions the distinction between color and width: React Profiler 文档中的这个注释提到了颜色和宽度之间的区别:

The width of a bar indicates how long it took to render the component (and its children) when they last rendered .条的宽度表示在组件(及其子组件)最后一次渲染时渲染它们所用的时间 If the component did not re-render as part of this commit, the time represents a previous render.如果组件没有作为此提交的一部分重新渲染,则时间表示先前的渲染。 The wider a component is, the longer it took to render.组件越宽,渲染时间越长。

The color of a bar indicates how long the component (and its children) took to render in the selected commit.条形图的颜色表示组件(及其子组件)在所选提交中呈现的时间。 Yellow components took more time, blue components took less time, and gray components did not render at all during this commit.黄色组件花费更多时间,蓝色组件花费更少时间,而灰色组件在此提交期间根本没有渲染。

The key part of the note about is "when they last rendered".关于注释的关键部分是“它们上次渲染的时间”。

Hope this helps clear up the confusion.希望这有助于消除混乱。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 解决似乎没有意义的ESLint / React / Redux(Airbnb配置)错误 - Resolving ESLint / React / Redux (Airbnb config) errors that don't seem to make sense 尝试理解 React - Trying to make sense with React 反应不要在循环内创建函数no-loop-func - react Don't make functions within a loop no-loop-func 反应:将整个状态传递给另一个组件是否有意义? - React: Does it make sense to pass the whole state to another component? 将 react-native 应用程序转换为 PWA 是否有意义? - Does it make sense to convert a react-native app to a PWA? 将dc.js转换为React是否有意义? - Does it make sense to convert dc.js to React? 在 React 中记忆大型数组操作有意义吗? - Does it make sense to memoize large array operations in React? 在React的shouldComponentUpdate中比较对象数组是否有意义? - Does it make sense to compare arrays of objects in React's shouldComponentUpdate? 我无法使用浏览器缩小导航栏和搜索栏以进行引导反应 - I can't make the nav bar and search bar shrink with the browser for bootstrap react 如果我们不做一个 React 组件作为 Presentation 组件,这个组件不是很容易被复用吗? - If we don't make a React component as Presentation component, isn't this component not easy to be re-used?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM