mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
f7a1ef6fb5
This removes 'to Number' casting in multiple benchmarks (which is handled by the benchmark runner) and cleans up some var usage in changed benchmarks. PR-URL: https://github.com/nodejs/node/pull/31581 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com>
28 lines
491 B
JavaScript
28 lines
491 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common.js');
|
|
const { OutgoingMessage } = require('_http_outgoing');
|
|
|
|
const bench = common.createBenchmark(main, {
|
|
value: [
|
|
'X-Powered-By',
|
|
'Vary',
|
|
'Set-Cookie',
|
|
'Content-Type',
|
|
'Content-Length',
|
|
'Connection',
|
|
'Transfer-Encoding',
|
|
],
|
|
n: [1e6],
|
|
});
|
|
|
|
function main({ n, value }) {
|
|
const og = new OutgoingMessage();
|
|
|
|
bench.start();
|
|
for (let i = 0; i < n; i++) {
|
|
og.setHeader(value, '');
|
|
}
|
|
bench.end(n);
|
|
}
|