Difference between 'self' and 'total' in Chrome CPU Profile of JS

JavascriptGoogle ChromeProfiling

Javascript Problem Overview


What is the difference between the 'self' and 'total' columns in the Chrome CPU profiling of JS code?

enter image description here

Javascript Solutions


Solution 1 - Javascript

self is how much time was spent doing work directly in that function.

total is how much time was spent in that function, and in the functions it called.

Solution 2 - Javascript

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.

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.

Article by Intel

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionCoolUserNameView Question on Stackoverflow
Solution 1 - Javascriptuser149341View Answer on Stackoverflow
Solution 2 - JavascriptJSON C11View Answer on Stackoverflow