Skip to content

Instantly share code, notes, and snippets.

@jbmoelker
Created October 18, 2017 08:23
Show Gist options
  • Save jbmoelker/af066fedeb121736faba454e1a76cfa6 to your computer and use it in GitHub Desktop.
Save jbmoelker/af066fedeb121736faba454e1a76cfa6 to your computer and use it in GitHub Desktop.
Paint timings table: log performance paint metrics to the console
if ('performance' in window) {
window.addEventListener('load', function () {
var paintMetrics = performance.getEntriesByType('paint');
if (paintMetrics !== undefined && paintMetrics.length > 0){
console.table(paintMetrics.map(function(metric) {
return {
event: metric.name,
startTime: metric.startTime.toFixed(2) + ' ms',
duration: metric.duration + ' ms'
}
}));
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment