Profiling with WebKit

Oct 4, 2011 • Jan Scheurer

Hello again! If you follow me on twitter you’ve already noticed that I took a look into the Chromium source. I was searching for a way to profile specific code snippets. I asked google for the WebKit Inspector Profile API with no result. So i digged around in the WebKit Inspector code and found out how it works.

console.profile('Hard Calculations');
// the script you want to profile
console.profileEnd();

Pretty easy, huh?* “Hard Calculations”* is the name of the profile that will be created. Btw. if you run this in the console itself you’ll only see injection functions so try it in your project.

Hope this was helpful for you. Have a nice day!