diff options
author | RaindropsSys <contact@minteck.org> | 2023-07-17 14:08:41 +0200 |
---|---|---|
committer | RaindropsSys <contact@minteck.org> | 2023-07-17 14:08:41 +0200 |
commit | d0da20e18bf39cd98c1a2773e3a08e8e320d6450 (patch) | |
tree | 0809782ccba92bbd76bb44a80a6d40bdaeb2f0ab /includes/external/signal/node_modules/asynckit/bench.js | |
parent | 5eb6a557c44462e7d9d752f3bc97a078ef205bc0 (diff) | |
download | pluralconnect-d0da20e18bf39cd98c1a2773e3a08e8e320d6450.tar.gz pluralconnect-d0da20e18bf39cd98c1a2773e3a08e8e320d6450.tar.bz2 pluralconnect-d0da20e18bf39cd98c1a2773e3a08e8e320d6450.zip |
Updated includes/jobs/PKFronters.php and added 147 files (automated)
Diffstat (limited to 'includes/external/signal/node_modules/asynckit/bench.js')
-rw-r--r-- | includes/external/signal/node_modules/asynckit/bench.js | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/includes/external/signal/node_modules/asynckit/bench.js b/includes/external/signal/node_modules/asynckit/bench.js new file mode 100644 index 0000000..c612f1a --- /dev/null +++ b/includes/external/signal/node_modules/asynckit/bench.js @@ -0,0 +1,76 @@ +/* eslint no-console: "off" */ + +var asynckit = require('./') + , async = require('async') + , assert = require('assert') + , expected = 0 + ; + +var Benchmark = require('benchmark'); +var suite = new Benchmark.Suite; + +var source = []; +for (var z = 1; z < 100; z++) +{ + source.push(z); + expected += z; +} + +suite +// add tests + +.add('async.map', function(deferred) +{ + var total = 0; + + async.map(source, + function(i, cb) + { + setImmediate(function() + { + total += i; + cb(null, total); + }); + }, + function(err, result) + { + assert.ifError(err); + assert.equal(result[result.length - 1], expected); + deferred.resolve(); + }); +}, {'defer': true}) + + +.add('asynckit.parallel', function(deferred) +{ + var total = 0; + + asynckit.parallel(source, + function(i, cb) + { + setImmediate(function() + { + total += i; + cb(null, total); + }); + }, + function(err, result) + { + assert.ifError(err); + assert.equal(result[result.length - 1], expected); + deferred.resolve(); + }); +}, {'defer': true}) + + +// add listeners +.on('cycle', function(ev) +{ + console.log(String(ev.target)); +}) +.on('complete', function() +{ + console.log('Fastest is ' + this.filter('fastest').map('name')); +}) +// run async +.run({ 'async': true }); |