Commit iniziale
This commit is contained in:
37
node_modules/tedious/benchmarks/request/rpcrequest-payload-varbinary.js
generated
vendored
Normal file
37
node_modules/tedious/benchmarks/request/rpcrequest-payload-varbinary.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
const { createBenchmark } = require('../common');
|
||||
|
||||
const { Request, TYPES } = require('tedious');
|
||||
const RpcRequestPayload = require('tedious/lib/rpcrequest-payload');
|
||||
|
||||
const { Readable } = require('stream');
|
||||
|
||||
const bench = createBenchmark(main, {
|
||||
n: [10, 100],
|
||||
size: [
|
||||
1024 * 1024,
|
||||
10 * 1024 * 1024,
|
||||
50 * 1024 * 1024,
|
||||
]
|
||||
});
|
||||
|
||||
function main({ n, size }) {
|
||||
const buf = Buffer.alloc(size, 'x');
|
||||
|
||||
const request = new Request('...', () => {});
|
||||
request.addParameter('value', TYPES.VarBinary, buf);
|
||||
|
||||
let i = 0;
|
||||
bench.start();
|
||||
|
||||
(function cb() {
|
||||
if (i++ === n) {
|
||||
bench.end(n);
|
||||
return;
|
||||
}
|
||||
|
||||
const payload = new RpcRequestPayload(request.sqlTextOrProcedure, request.parameters, Buffer.alloc(0), {}, undefined);
|
||||
const stream = Readable.from(payload);
|
||||
stream.on('data', () => {});
|
||||
stream.on('end', cb);
|
||||
})();
|
||||
}
|
||||
Reference in New Issue
Block a user