-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
benchmark: cut down http benchmark run time
PR-URL: #18379 Reviewed-By: Jon Moss <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
- Loading branch information
1 parent
4f4bfbe
commit d469a06
Showing
3 changed files
with
35 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters