benchmark: cut down http benchmark run time by joyeecheung · Pull Request #18379 · nodejs/node · GitHub
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchmark/_http-benchmarkers.js
32 changes: 32 additions & 0 deletions benchmark/http/set-header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'use strict';
const common = require('../common.js');
const PORT = common.PORT;

const bench = common.createBenchmark(main, {
res: ['normal', 'setHeader', 'setHeaderWH']
});

const type = 'bytes';
const len = 4;
const chunks = 0;
const chunkedEnc = 0;
const c = 50;

// normal: writeHead(status, {...})
// setHeader: statusCode = status, setHeader(...) x2
// setHeaderWH: setHeader(...), writeHead(status, ...)
function main({ res }) {
process.env.PORT = PORT;
var server = require('../fixtures/simple-http-server.js')
.listen(PORT)
.on('listening', function() {
const path = `/${type}/${len}/${chunks}/normal/${chunkedEnc}`;

bench.http({
path: path,
connections: c
}, function() {
server.close();
});
});
}
5 changes: 2 additions & 3 deletions benchmark/http/simple.js