0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/benchmark/http2/write.js
Daniel Bevenius 3294d1bf62 src: remove --expose-http2 option
This commit removes the --expose-http2 option. In the code comment it
states that this should should be noop through v9.x, and it sounds like
it can be removed for 10.x and above.

PR-URL: https://github.com/nodejs/node/pull/20887
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-05-24 08:28:02 +02:00

36 lines
838 B
JavaScript

'use strict';
const common = require('../common.js');
const bench = common.createBenchmark(main, {
streams: [100, 200, 1000],
length: [64 * 1024, 128 * 1024, 256 * 1024, 1024 * 1024],
size: [100000],
benchmarker: ['h2load']
}, { flags: ['--no-warnings'] });
function main({ streams, length, size }) {
const http2 = require('http2');
const server = http2.createServer();
server.on('stream', (stream) => {
stream.respond();
let written = 0;
function write() {
stream.write('ü'.repeat(size));
written += size;
if (written < length)
setImmediate(write);
else
stream.end();
}
write();
});
server.listen(common.PORT, () => {
bench.http({
path: '/',
requests: 10000,
maxConcurrentStreams: streams,
}, () => { server.close(); });
});
}