Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reveal line level profiling in JS sources?

I've read this article about analyzing runtime performance. The image below is copied from this article. If you check this image, there are yellow highlighted execution time hints for JS files next to each line in the file.

I find this line level profiling feature pretty useful and I would like to try it in my own projects, too.

However, when I open a JS source file in the sources tab, I cannot see it. Note that, I already took a performance profiling snapshot. But still I cannot see this execution time hints.

How can I reveal this feature?

Thanks.

enter image description here

like image 247
ankakusu Avatar asked Aug 09 '18 20:08

ankakusu


People also ask

How do you read a performance profile?

To access the Performance tab, navigate to the website you want to profile, then open Chrome DevTools by right-clicking and selecting Inspect. Select the Performance tab inside Chrome DevTools. The easiest way to capture a performance profile is by clicking the Start profiling and reload page icon.

How do you use profiling in JavaScript?

If you prefer the old "Record JavaScript CPU Profile" workflow that used to be available on the Profiles panel, you can still access it like so: Open the DevTools main menu. Select More tools > JavaScript Profiler. The old profiler opens in a new panel called JavaScript Profiler.

What is record JavaScript CPU profile?

JavaScript CPU profile Shows how much CPU time our JavaScript is taking. CSS selector profile Shows how much CPU time is spent processing CSS selectors.

What is scripting in chrome performance?

To be able to visually identify what was going on when you profiled your website, Timeline is painted in different colors. JavaScript execution time is marked in yellow and it's called Scripting. The purple area shows the Rendering and the green parts of the Timeline show the Painting process.


1 Answers

it's seems that it's removed to new tab. you can try this:

  1. open javascript profile tab (or ctrl+ shift + p on win and type javascript profile)
  2. start to record the site and refresh
  3. stop the record
  4. click on one of the js file enter image description here

  5. you got exactly what you need enter image description here

like image 140
Asaf Ben Moshe Avatar answered Oct 28 '22 20:10

Asaf Ben Moshe