Javascript JS 的 Chrome CPU Profile 中“self”和“total”的区别
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7127671/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Difference between 'self' and 'total' in Chrome CPU Profile of JS
提问by CoolUserName
What is the difference between the 'self' and 'total' columns in the Chrome CPU profiling of JS code?
JS 代码的 Chrome CPU 分析中的“self”和“total”列有什么区别?
回答by duskwuff -inactive-
self
is how much time was spent doing work directly in that function.
self
是直接在该函数中工作所花费的时间。
total
is how much time was spent in that function, and in the functions it called.
total
是在该函数及其调用的函数中花费了多少时间。
回答by JSON C11
Self Time:For a function, is the amount of time to execute code within the function (inline statements). Checking the performance of individual functions is known as bottom-up analysis.
Self Time:对于函数,是在函数内执行代码(内联语句)的时间。 检查单个功能的性能称为自底向上分析。
Total Time:For a function, is the self time of that function and the self times of all functions that function calls. Checking the performance of functions along with their callees is top-down analysis.
总时间:对于一个函数,是该函数的自时间和该函数调用的所有函数的自时间。 检查函数及其被调用者的性能是自上而下的分析。
NB:Just because a function has a high self time, doesn't mean that the function itself is inefficient. It is also important to look at how many times that function is being called.
NB:仅仅因为一个函数具有很高的自我时间,并不意味着该函数本身是低效的。查看该函数被调用的次数也很重要。