mirror of
https://github.com/nodejs/node.git
synced 2024-11-29 07:00:59 +01:00
benchmark: (streams) use destructuring
PR-URL: https://github.com/nodejs/node/pull/18250 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
5dc289b3f0
commit
592454e703
@ -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() {}
|
||||
|
@ -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() {}
|
||||
|
@ -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() {};
|
||||
|
||||
|
@ -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() {}
|
||||
|
@ -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() {}
|
||||
|
@ -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();
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user