diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2018-01-26 00:09:55 +0800 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-02-01 11:43:30 +0100 |
commit | 54b3a685c198a7b2c277c2a223041ec203375358 (patch) | |
tree | 71989b34d2d3b1493e836c5e7defd297db6ba4bf /benchmark/http | |
parent | 2d6912a46bf6f56a4f7b1d354680ad318cc7a153 (diff) | |
download | android-node-v8-54b3a685c198a7b2c277c2a223041ec203375358.tar.gz android-node-v8-54b3a685c198a7b2c277c2a223041ec203375358.tar.bz2 android-node-v8-54b3a685c198a7b2c277c2a223041ec203375358.zip |
benchmark: cut down http benchmark run time
PR-URL: https://github.com/nodejs/node/pull/18379
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'benchmark/http')
-rw-r--r-- | benchmark/http/set-header.js | 32 | ||||
-rw-r--r-- | benchmark/http/simple.js | 5 |
2 files changed, 34 insertions, 3 deletions
diff --git a/benchmark/http/set-header.js b/benchmark/http/set-header.js new file mode 100644 index 0000000000..f0987f2cc7 --- /dev/null +++ b/benchmark/http/set-header.js @@ -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(); + }); + }); +} diff --git a/benchmark/http/simple.js b/benchmark/http/simple.js index bbc59a341d..6d1851c45e 100644 --- a/benchmark/http/simple.js +++ b/benchmark/http/simple.js @@ -7,15 +7,14 @@ const bench = common.createBenchmark(main, { len: [4, 1024, 102400], chunks: [1, 4], c: [50, 500], - chunkedEnc: [1, 0], - res: ['normal', 'setHeader', 'setHeaderWH'] + chunkedEnc: [1, 0] }); function main({ type, len, chunks, c, chunkedEnc, res }) { var server = require('../fixtures/simple-http-server.js') .listen(common.PORT) .on('listening', function() { - const path = `/${type}/${len}/${chunks}/${res}/${chunkedEnc}`; + const path = `/${type}/${len}/${chunks}/normal/${chunkedEnc}`; bench.http({ path: path, |