aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--benchmark/_http-benchmarkers.js2
-rw-r--r--benchmark/http/set-header.js32
-rw-r--r--benchmark/http/simple.js5
3 files changed, 35 insertions, 4 deletions
diff --git a/benchmark/_http-benchmarkers.js b/benchmark/_http-benchmarkers.js
index 55ebcc96ba..76e02504b2 100644
--- a/benchmark/_http-benchmarkers.js
+++ b/benchmark/_http-benchmarkers.js
@@ -185,7 +185,7 @@ exports.run = function(options, callback) {
port: exports.PORT,
path: '/',
connections: 100,
- duration: 10,
+ duration: 5,
benchmarker: exports.default_http_benchmarker
}, options);
if (!options.benchmarker) {
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,