Skip to content

Commit

Permalink
Add filter benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
megawac committed Jul 23, 2016
1 parent 66d6bbe commit 5b8931d
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions perf/suites.js
@@ -1,5 +1,6 @@
var _ = require("lodash");
var tasks;
var count;

module.exports = [{
name: "each",
Expand Down Expand Up @@ -93,6 +94,42 @@ module.exports = [{
async.setImmediate(cb);
}, done);
}
}, {
name: "filter",
args: [
[10],
[300],
[10000]
],
setup: function(c) {
count = c;
tasks = _.range(count);
},
fn: function(async, done) {
async.filter(tasks, function(num, cb) {
async.setImmediate(function() {
cb(null, num > (count / 2));
});
}, done);
}
}, {
name: "filterLimit",
args: [
[10],
[300],
[10000]
],
setup: function(c) {
count = c;
tasks = _.range(count);
},
fn: function(async, done) {
async.filterLimit(tasks, 10, function(num, cb) {
async.setImmediate(function() {
cb(null, num > (count / 2));
});
}, done);
}
}, {
name: "eachOf",
// args lists are passed to the setup function
Expand Down

0 comments on commit 5b8931d

Please sign in to comment.