Skip to content

Commit

Permalink
update performance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kupriyanenko committed May 3, 2014
1 parent 9e71506 commit 0024fe2
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 61 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"devDependencies": {
"mocha": "1.13.0",
"expect": "0.2.0",
"astrobench": "0.0.1"
"astrobench": "0.0.2"
}
}
80 changes: 40 additions & 40 deletions perf/attributes.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
describe("Set attribute", function() {
setup(function(suite) {
describe("Set attribute", function(suite) {
setup(function() {
suite.jbEl = jBone('<span>');
suite.jqEl = jQuery('<span>');
});

bench("jBone", function(suite) {
bench("jBone", function() {
suite.jbEl.attr('name', 'value');
});

bench("jQuery", function(suite) {
bench("jQuery", function() {
suite.jqEl.attr('name', 'value');
});
});

describe("Get attribute", function() {
setup(function(suite) {
describe("Get attribute", function(suite) {
setup(function() {
suite.jbEl = jBone('<span>', {
name: 'value'
});
Expand All @@ -23,131 +23,131 @@ describe("Get attribute", function() {
});
});

bench("jBone", function(suite) {
bench("jBone", function() {
suite.jbEl.attr('name');
});

bench("jQuery", function(suite) {
bench("jQuery", function() {
suite.jqEl.attr('name');
});
});

describe("Set value", function() {
setup(function(suite) {
describe("Set value", function(suite) {
setup(function() {
suite.jbEl = jBone('<input>');
suite.jqEl = jQuery('<input>');
});

bench("jBone", function(suite) {
bench("jBone", function() {
suite.jbEl.val('name', 'value');
});

bench("jQuery", function(suite) {
bench("jQuery", function() {
suite.jqEl.val('name', 'value');
});
});

describe("Get value", function() {
setup(function(suite) {
describe("Get value", function(suite) {
setup(function() {
suite.jbEl = jBone('<input>').val('name', 'value');
suite.jqEl = jQuery('<input>').val('name', 'value');
});

bench("jBone", function(suite) {
bench("jBone", function() {
suite.jbEl.val('name');
});

bench("jQuery", function(suite) {
bench("jQuery", function() {
suite.jqEl.val('name');
});
});

describe("Set css", function() {
setup(function(suite) {
describe("Set css", function(suite) {
setup(function() {
suite.jbEl = jBone('<span>');
suite.jqEl = jQuery('<span>');
});

bench("jBone", function(suite) {
bench("jBone", function() {
suite.jbEl.css('color', 'red');
});

bench("jQuery", function(suite) {
bench("jQuery", function() {
suite.jqEl.css('color', 'red');
});
});

describe("Get css", function() {
setup(function(suite) {
describe("Get css", function(suite) {
setup(function() {
suite.jbEl = jBone('<span>').css('color', 'red').appendTo('#suite');
suite.jqEl = jQuery('<span>').css('color', 'red').appendTo('#suite');
});

bench("jBone", function(suite) {
bench("jBone", function() {
suite.jbEl.css('color');
});

bench("jQuery", function(suite) {
bench("jQuery", function() {
suite.jqEl.css('color');
});
});

describe("Set normal data", function() {
setup(function(suite) {
describe("Set normal data", function(suite) {
setup(function() {
suite.jbEl = jBone('<span>');
suite.jqEl = jQuery('<span>');
});

bench("jBone", function(suite) {
bench("jBone", function() {
suite.jbEl.data('key', 'value');
});

bench("jQuery", function(suite) {
bench("jQuery", function() {
suite.jqEl.data('key', 'value');
});
});

describe("Set object data", function() {
setup(function(suite) {
describe("Set object data", function(suite) {
setup(function() {
suite.jbEl = jBone('<span>');
suite.jqEl = jQuery('<span>');
});

bench("jBone", function(suite) {
bench("jBone", function() {
suite.jbEl.data('key', {});
});

bench("jQuery", function(suite) {
bench("jQuery", function() {
suite.jqEl.data('key', {});
});
});

describe("Get normal data", function() {
setup(function(suite) {
describe("Get normal data", function(suite) {
setup(function() {
suite.jbEl = jBone('<span>').data('key', 'value');
suite.jqEl = jQuery('<span>').data('key', 'value');
});

bench("jBone", function(suite) {
bench("jBone", function() {
suite.jbEl.data('key');
});

bench("jQuery", function(suite) {
bench("jQuery", function() {
suite.jqEl.data('key');
});
});

describe("Get object data", function() {
setup(function(suite) {
describe("Get object data", function(suite) {
setup(function() {
suite.jbEl = jBone('<span>').data('key', {});
suite.jqEl = jQuery('<span>').data('key', {});
});

bench("jBone", function(suite) {
bench("jBone", function() {
suite.jbEl.data('key');
});

bench("jQuery", function(suite) {
bench("jQuery", function() {
suite.jqEl.data('key');
});
});
8 changes: 4 additions & 4 deletions perf/backbone.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ jbBackbone.$ = jBone;
var jqBackbone = Backbone.noConflict();
jqBackbone.$ = jQuery;

describe("Backbone View", function() {
setup(function(suite) {
describe("Backbone View", function(suite) {
setup(function() {
suite.jbView = jbBackbone.View.extend({
events: { click: function() {} }
});
Expand All @@ -15,11 +15,11 @@ describe("Backbone View", function() {
});
});

bench("jBone", function(suite) {
bench("jBone", function() {
(new suite.jbView()).remove();
});

bench("jQuery", function(suite) {
bench("jQuery", function() {
(new suite.jqView()).remove();
});
});
24 changes: 12 additions & 12 deletions perf/events.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
describe("on/off events", function() {
setup(function(suite) {
describe("on/off events", function(suite) {
setup(function() {
suite.jbEl = jBone('<span>');
suite.jqEl = jQuery('<span>');
});

bench("jBone", function(suite) {
bench("jBone", function() {
suite.jbEl.on('click', function() {}).off();
});

bench("jQuery", function(suite) {
bench("jQuery", function() {
suite.jqEl.on('click', function() {}).off();
});
});

describe("off with eventType", function() {
setup(function(suite) {
describe("off with eventType", function(suite) {
setup(function() {
suite.jbEl = jBone('<span>');
suite.jqEl = jQuery('<span>');
});

bench("jBone", function(suite) {
bench("jBone", function() {
suite.jbEl.on('click', function() {}).off('click');
});

bench("jQuery", function(suite) {
bench("jQuery", function() {
suite.jqEl.on('click', function() {}).off('click');
});
});

describe("off with namespace", function() {
setup(function(suite) {
describe("off with namespace", function(suite) {
setup(function() {
suite.jbEl = jBone('<span>');
suite.jqEl = jQuery('<span>');
});

bench("jBone", function(suite) {
bench("jBone", function() {
suite.jbEl.on('click.space', function() {}).off('.space');
});

bench("jQuery", function(suite) {
bench("jQuery", function() {
suite.jqEl.on('click.space', function() {}).off('.space');
});
});
8 changes: 4 additions & 4 deletions perf/manipulation.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
describe("Remove Element", function() {
setup(function(suite) {
describe("Remove Element", function(suite) {
setup(function() {
suite.jbEl = jBone('<span>');
suite.jqEl = jQuery('<span>');
});

bench("jBone", function(suite) {
bench("jBone", function() {
suite.jbEl.remove();
});

bench("jQuery", function(suite) {
bench("jQuery", function() {
suite.jqEl.remove();
});
});

0 comments on commit 0024fe2

Please sign in to comment.