summaryrefslogtreecommitdiff
path: root/perf
diff options
context:
space:
mode:
authorGraeme Yeates <yeatesgraeme@gmail.com>2016-07-23 11:13:31 -0400
committerGraeme Yeates <yeatesgraeme@gmail.com>2016-07-23 11:13:31 -0400
commit5b8931d40205778a5bf4e936efb10046b79eb018 (patch)
treef70b0af08661ed10733fd179a3cafa5850a5db3d /perf
parent66d6bbe7f174bc3adebf71d23d43d6bf05a64fb3 (diff)
downloadasync-5b8931d40205778a5bf4e936efb10046b79eb018.tar.gz
Add filter benchmarkloops
Diffstat (limited to 'perf')
-rw-r--r--perf/suites.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/perf/suites.js b/perf/suites.js
index 244b32b..dfef9f6 100644
--- a/perf/suites.js
+++ b/perf/suites.js
@@ -1,5 +1,6 @@
var _ = require("lodash");
var tasks;
+var count;
module.exports = [{
name: "each",
@@ -94,6 +95,42 @@ module.exports = [{
}, 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
args: [