mirror of
https://github.com/nodejs/node.git
synced 2025-05-15 19:48:12 +00:00

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>
22 lines
453 B
JavaScript
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);
|
|
}
|