Bartosz Dziewoński has uploaded a new change for review.
https://gerrit.wikimedia.org/r/269159
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, 12 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/59/269159/1
diff --git a/demos/demo.js b/demos/demo.js
index 97faea5..1f4f1b4 100644
--- a/demos/demo.js
+++ b/demos/demo.js
@@ -185,13 +185,24 @@
* Load the demo page. Must be called after $element is attached.
*/
OO.ui.Demo.prototype.initialize = function () {
+ // 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();
+ }
+
var demo = this,
promises = this.stylesheetLinks.map( function ( el ) {
return $( el ).data( 'load-promise' );
} );
$.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: newchange
Gerrit-Change-Id: Ib50aeaf33a0f05a01612b6d290c4a3e823296783
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits