jenkins-bot has submitted this change and it was merged.
Change subject: demo: Measure time needed to construct the demo
......................................................................
demo: Measure time needed to construct the demo
On my machine, it takes around 750-900 ms for the widgets demo. (Try it
with debugger closed, as it takes 5 times or so longer with it open.)
Change-Id: Ib50aeaf33a0f05a01612b6d290c4a3e823296783
---
M demos/demo.js
M demos/infusion.js
2 files changed, 13 insertions(+), 1 deletion(-)
Approvals:
Jforrester: Looks good to me, approved
jenkins-bot: Verified
diff --git a/demos/demo.js b/demos/demo.js
index 97faea5..b41d1f7 100644
--- a/demos/demo.js
+++ b/demos/demo.js
@@ -189,9 +189,21 @@
promises = this.stylesheetLinks.map( function ( el ) {
return $( el ).data( 'load-promise' );
} );
+
+ // Helper function to get high resolution profiling data, where
available.
+ function now() {
+ /*global performance */
+ return ( typeof performance !== 'undefined' ) ?
performance.now() :
+ Date.now ? Date.now() : new Date().getTime();
+ }
+
$.when.apply( $, promises )
.done( function () {
+ var start, end;
+ start = now();
demo.constructor.static.pages[ demo.mode.page ]( demo );
+ end = now();
+ window.console.log( 'Took ' + ( end - start ) + ' ms to
build demo page.' );
} )
.fail( function () {
demo.$element.append( $( '<p>' ).text( 'Demo styles
failed to load.' ) );
diff --git a/demos/infusion.js b/demos/infusion.js
index ea927ea..27ae90a 100644
--- a/demos/infusion.js
+++ b/demos/infusion.js
@@ -21,7 +21,7 @@
return OO.ui.infuse( e.id );
} );
end = now();
- window.console.log( 'Infusion time: ' + ( end - start ) );
+ window.console.log( 'Took ' + ( end - start ) + ' ms to infuse demo
page.' );
infuseButton.setDisabled( true );
}
--
To view, visit https://gerrit.wikimedia.org/r/269159
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib50aeaf33a0f05a01612b6d290c4a3e823296783
Gerrit-PatchSet: 4
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz DziewoĆski <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits