Profiling Javascript Performance with the Console | Task

Ole Ersoy
Jan - 18  -  1 min

Scenario

We want to see how many milliseconds it takes to mutate a count index reference from one to a million.

Approach

Use console.time.

console.time('count performance');
for (let count = 0; count++; count <= 1000000) {
  //Profile how long this takes
}
console.timeEnd('count performance');

This will log.

count performance: 0.005126953125 ms

Demo