Skip to content

Instantly share code, notes, and snippets.

@rwjblue
Last active July 5, 2016 02:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rwjblue/f4f56ed8cbfa421956de6183bb384d29 to your computer and use it in GitHub Desktop.
Save rwjblue/f4f56ed8cbfa421956de6183bb384d29 to your computer and use it in GitHub Desktop.
Using chrome-tracing to test changes in https://github.com/emberjs/ember.js/pull/13783
let fs = require('fs');
let InitialRenderBenchmark = require('chrome-tracing').InitialRenderBenchmark;
let benchmark = new InitialRenderBenchmark({
name: "test initial render",
url: `http://localhost:4200/crates/solicit`,
browser: {
type: 'system'
}
});
benchmark.run().then((result) => {
let output = '';
result.samples.forEach(function(result) {
let sampleOutput = result.duration + ',' + process.env.LABEL;
output += sampleOutput + '\n';
console.log(sampleOutput);
});
fs.appendFileSync('samples.csv', output, { encoding: 'utf8' });
}).catch((err) => {
console.error(err.stack);
process.exit(1);
});
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
μs set
33122 control
25745 control
77119 control
25834 control
70069 control
35168 control
79324 control
22677 control
80341 control
35324 control
35818 control
33035 control
23192 control
22788 control
23607 control
34107 control
93018 control
34983 control
72410 control
23266 control
93903 control
23310 control
79879 control
23776 control
77186 control
23170 control
67752 control
22698 control
71656 control
20721 control
44677 experiment
25372 experiment
23840 experiment
70851 experiment
24163 experiment
23860 experiment
31102 experiment
24232 experiment
83187 experiment
22045 experiment
80257 experiment
23470 experiment
30373 experiment
69692 experiment
34202 experiment
70131 experiment
22780 experiment
22342 experiment
23037 experiment
34424 experiment
26717 experiment
34360 experiment
23649 experiment
23332 experiment
23248 experiment
36315 experiment
87634 experiment
34490 experiment
71185 experiment
22373 experiment
diff --git a/app/router.js b/app/router.js
index d858f0d..69f3ab8 100644
--- a/app/router.js
+++ b/app/router.js
@@ -1,9 +1,30 @@
+/* global performance */
import Ember from 'ember';
import config from './config/environment';
import googlePageview from './mixins/google-pageview';
const Router = Ember.Router.extend(googlePageview, {
- location: config.locationType
+ location: config.locationType,
+
+ init() {
+ this._super(...arguments);
+
+
+ function endTrace() {
+ // just before paint
+ requestAnimationFrame(function () {
+ // after paint
+ requestAnimationFrame(() => {
+ document.location.href = 'about:blank';
+ });
+ });
+ }
+
+ this.on('didTransition', () => {
+ performance.mark('didTransition');
+ Ember.run.schedule('afterRender', endTrace);
+ });
+ }
});
Router.map(function() {
diff --git a/ember-cli-build.js b/ember-cli-build.js
index 2f64694..a349a11 100644
--- a/ember-cli-build.js
+++ b/ember-cli-build.js
@@ -5,6 +5,9 @@ var EmberApp = require('ember-cli/lib/broccoli/ember-app');
module.exports = function(defaults) {
var app = new EmberApp(defaults, {
// Add options here
+ minifyJS: {
+ enabled: false
+ }
});
// Use `app.import` to add additional libraries to the generated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment