Permalink
Browse files

Updated performance tests to latest spec

  • Loading branch information...
1 parent 36aa097 commit 2843ed192a81f95815237ffa557b8e9ae8ef89b7 @derek committed Mar 27, 2013
@@ -1,28 +1,41 @@
-YUI().use('app', 'benchmark', function (Y) {
-
- var suite = new Benchmark.Suite();
- Y.Benchmark.addTest(suite);
+YUI.add('app-benchmark', function (Y, NAME) {
+ var suite = Y.Benchmark.suite;
+
// -- Y.Model ------------------------------------------------------------------
- suite.add('Y.Model: Instantiate a bare model', function () {
- var model = new Y.Model();
+ suite.add({
+ Y: Y,
+ name: 'Y.Model: Instantiate a bare model',
+ fn: function () {
+ var model = new Y.Model();
+ }
});
- suite.add('Y.Model: Subclass and instantiate a bare model', function () {
- var MyModel = Y.Base.create('myModel', Y.Model, []),
- model = new MyModel();
+ suite.add({
+ Y: Y,
+ name: 'Y.Model: Subclass and instantiate a bare model',
+ fn: function () {
+ var MyModel = Y.Base.create('myModel', Y.Model, []),
+ model = new MyModel();
+ }
});
// -- Y.View -------------------------------------------------------------------
- suite.add('Y.View: Instantiate a bare view', function () {
- var view = new Y.View();
+ suite.add({
+ Y: Y,
+ name: 'Y.View: Instantiate a bare view',
+ fn: function () {
+ var view = new Y.View();
+ }
});
- suite.add('Y.View: Instantiate and subclass a bare view', function () {
- var MyView = Y.Base.create('myView', Y.View, []),
- view = new MyView();
+ suite.add({
+ Y: Y,
+ name: 'Y.View: Instantiate and subclass a bare view',
+ fn: function () {
+ var MyView = Y.Base.create('myView', Y.View, []),
+ view = new MyView();
+ }
});
-
- suite.run(true);
-
-});
+
+}, '@VERSION@', {requires: ['app']});
@@ -1,7 +1,6 @@
-YUI().use('base', 'benchmark', function (Y) {
+YUI.add('base-benchmark', function (Y) {
- var suite = new Benchmark.Suite();
- Y.Benchmark.addTest(suite);
+ var suite = Y.Benchmark.suite;
var MyBase20 = function() {
MyBase20.superclass.constructor.apply(this, arguments);
@@ -357,39 +356,70 @@ YUI().use('base', 'benchmark', function (Y) {
Y.extend(MyBaseCore, Y.BaseCore);
- suite.add('Base', function () {
- var b = new Y.Base();
- });
-
- suite.add('MyBase', function () {
- var b = new MyBase();
- });
-
- suite.add('MyBase with 10 simple value attributes', function () {
- var b = new MyBase10();
- });
-
- suite.add('MyBase with 20 varied attributes', function () {
- var b = new MyBase20();
- });
-
- // // BaseCore
-
- suite.add('BaseCore', function () {
- var b = new Y.BaseCore();
- });
-
- suite.add('MyBaseCore', function () {
- var b = new MyBaseCore();
- });
-
- suite.add('MyBaseCore with 10 simple value attributes', function () {
- var b = new MyBaseCore10();
+ suite.add({
+ Y: Y,
+ name: 'Base',
+ fn: function () {
+ var b = new Y.Base();
+ }
});
- suite.add('MyBaseCore with 20 varied attributes', function () {
- var b = new MyBaseCore20();
+ suite.add({
+ Y: Y,
+ name: 'MyBase',
+ fn: function () {
+ var b = new MyBase();
+ }
});
- suite.run(true);
-});
+ // suite.add({
+ // Y: Y,
+ // name: 'MyBase with 10 simple value attributes',
+ // fn: function () {
+ // var b = new MyBase10();
+ // }
+ // });
+
+ // suite.add({
+ // Y: Y,
+ // name: 'MyBase with 20 varied attributes',
+ // fn: function () {
+ // var b = new MyBase20();
+ // }
+ // });
+
+ // // // BaseCore
+
+ // suite.add({
+ // Y: Y,
+ // name: 'BaseCore',
+ // fn: function () {
+ // var b = new Y.BaseCore();
+ // }
+ // });
+
+ // suite.add({
+ // Y: Y,
+ // name: 'MyBaseCore',
+ // fn: function () {
+ // var b = new MyBaseCore();
+ // }
+ // });
+
+ // suite.add({
+ // Y: Y,
+ // name: 'MyBaseCore with 10 simple value attributes',
+ // fn: function () {
+ // var b = new MyBaseCore10();
+ // }
+ // });
+
+ // suite.add({
+ // Y: Y,
+ // name: 'MyBaseCore with 20 varied attributes',
+ // fn: function () {
+ // var b = new MyBaseCore20();
+ // }
+ // });
+
+}, '@VERSION@', {requires: ['base']});
@@ -1,23 +1,32 @@
-YUI().use('scrollview-base', 'benchmark', function (Y) {
+YUI.add('scrollview-benchmark', function (Y, NAME) {
- var container = document.createElement('div'),
- bench,
+ var suite = Y.Benchmark.suite,
+ container,
scrollview;
-
+
+ container = document.createElement('div')
container.id = "container";
document.body.appendChild(container);
- var suite = new Benchmark.Suite();
-
- Y.Benchmark.addTest(suite);
-
- suite.add("Create and Destroy", function () {
- scrollview = new Y.ScrollView({
- render: container
- });
- scrollview.destroy();
+ suite.add({
+ Y: Y,
+ name: 'ScrollView: Create',
+ fn: function () {
+ scrollview = new Y.ScrollView({
+ render: container
+ });
+ }
});
- suite.run();
+ suite.add({
+ Y: Y,
+ name: 'ScrollView: Create & Destroy',
+ fn: function () {
+ scrollview = new Y.ScrollView({
+ render: container
+ });
+ scrollview.destroy();
+ }
+ });
-});
+}, '@VERSION@', {requires: ['scrollview-base']});

0 comments on commit 2843ed1

Please sign in to comment.