Skip to content

Instantly share code, notes, and snippets.

@alexdiliberto
Last active March 25, 2020 11:14
Show Gist options
  • Save alexdiliberto/90e5e4217d97c7f72006 to your computer and use it in GitHub Desktop.
Save alexdiliberto/90e5e4217d97c7f72006 to your computer and use it in GitHub Desktop.
Ember performance profiling tips in Chrome
  • Test in a clean environment

https://developer.chrome.com/devtools/docs/clean-testing-environment

  • Test against prod build

ember s --environment=production

  • Don't minify JS
// ember-cli-build.js

minifyJS: {
  enabled: false;
}
  • Programatically trigger perf profile or (accurate) time profile
console.profile([label]);
// ... do stuff
console.profileEnd([label]);
// Now a new profile will be created

console.time([label]);
// ... do stuff
console.timeEnd([label]);
// Now it will show time in the console
// Example: Timeline profile for the individual route rendering time
beforeModel() {
  console.time('foo');
  Ember.run.scheduleOnce('afterRender', console, 'timeEnd', 'foo');
}
  • Programatically timestamp critical points in the application
console.timeStamp([label]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment