node/benchmark/streams/transform-creation.js
Ruben Bridgewater 592454e703
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>
2018-01-23 01:29:20 +01:00

22 lines
453 B
JavaScript

'use strict';
const common = require('../common.js');
const Transform = require('stream').Transform;
const inherits = require('util').inherits;
const bench = common.createBenchmark(main, {
n: [1e6]
});
function MyTransform() {
Transform.call(this);
}
inherits(MyTransform, Transform);
MyTransform.prototype._transform = function() {};
function main({ n }) {
bench.start();
for (var i = 0; i < n; ++i)
new MyTransform();
bench.end(n);
}