Skip to content

Commit

Permalink
benchmark: (streams) use destructuring
Browse files Browse the repository at this point in the history
PR-URL: #18250
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
BridgeAR authored and evanlucas committed Jan 30, 2018
1 parent 11d6458 commit 81abea5
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 16 deletions.
3 changes: 1 addition & 2 deletions benchmark/streams/readable-bigread.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ const bench = common.createBenchmark(main, {
n: [100e1]
});

function main(conf) {
const n = +conf.n;
function main({ n }) {
const b = new Buffer(32);
const s = new Readable();
function noop() {}
Expand Down
3 changes: 1 addition & 2 deletions benchmark/streams/readable-bigunevenread.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ const bench = common.createBenchmark(main, {
n: [100e1]
});

function main(conf) {
const n = +conf.n;
function main({ n }) {
const b = new Buffer(32);
const s = new Readable();
function noop() {}
Expand Down
5 changes: 2 additions & 3 deletions benchmark/streams/readable-boundaryread.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ const bench = common.createBenchmark(main, {
type: ['string', 'buffer']
});

function main(conf) {
const n = +conf.n;
function main({ n, type }) {
const s = new Readable();
var data = 'a'.repeat(32);
if (conf.type === 'buffer')
if (type === 'buffer')
data = Buffer.from(data);
s._read = function() {};

Expand Down
3 changes: 1 addition & 2 deletions benchmark/streams/readable-readall.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ const bench = common.createBenchmark(main, {
n: [50e2]
});

function main(conf) {
const n = +conf.n;
function main({ n }) {
const b = new Buffer(32);
const s = new Readable();
function noop() {}
Expand Down
3 changes: 1 addition & 2 deletions benchmark/streams/readable-unevenread.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ const bench = common.createBenchmark(main, {
n: [100e1]
});

function main(conf) {
const n = +conf.n;
function main({ n }) {
const b = new Buffer(32);
const s = new Readable();
function noop() {}
Expand Down
4 changes: 1 addition & 3 deletions benchmark/streams/transform-creation.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ function MyTransform() {
inherits(MyTransform, Transform);
MyTransform.prototype._transform = function() {};

function main(conf) {
const n = +conf.n;

function main({ n }) {
bench.start();
for (var i = 0; i < n; ++i)
new MyTransform();
Expand Down
3 changes: 1 addition & 2 deletions benchmark/streams/writable-manywrites.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ const bench = common.createBenchmark(main, {
n: [2e6]
});

function main(conf) {
const n = +conf.n;
function main({ n }) {
const b = Buffer.allocUnsafe(1024);
const s = new Writable();
s._write = function(chunk, encoding, cb) {
Expand Down

0 comments on commit 81abea5

Please sign in to comment.