summaryrefslogtreecommitdiff
path: root/deps/node/benchmark/_test-double-benchmarker.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-08-13 12:29:07 +0200
committerFlorian Dold <florian.dold@gmail.com>2019-08-13 12:29:22 +0200
commitda736d8259331a8ef13bf4bbb10bbb8a5c0e5299 (patch)
tree4d849133b1c9a9c7067e96ff7dd8faa1d927e0bb /deps/node/benchmark/_test-double-benchmarker.js
parentda228cf9d71b747f1824e85127039e5afc7effd8 (diff)
downloadakono-da736d8259331a8ef13bf4bbb10bbb8a5c0e5299.tar.gz
akono-da736d8259331a8ef13bf4bbb10bbb8a5c0e5299.tar.bz2
akono-da736d8259331a8ef13bf4bbb10bbb8a5c0e5299.zip
remove node/v8 from source tree
Diffstat (limited to 'deps/node/benchmark/_test-double-benchmarker.js')
-rw-r--r--deps/node/benchmark/_test-double-benchmarker.js43
1 files changed, 0 insertions, 43 deletions
diff --git a/deps/node/benchmark/_test-double-benchmarker.js b/deps/node/benchmark/_test-double-benchmarker.js
deleted file mode 100644
index b9379b90..00000000
--- a/deps/node/benchmark/_test-double-benchmarker.js
+++ /dev/null
@@ -1,43 +0,0 @@
-'use strict';
-
-const myModule = process.argv[2];
-if (!['http', 'http2'].includes(myModule)) {
- throw new Error(`Invalid module for benchmark test double: ${myModule}`);
-}
-
-const http = require(myModule);
-
-const duration = process.env.duration || 0;
-const url = process.env.test_url;
-
-const start = process.hrtime();
-let throughput = 0;
-
-function request(res, client) {
- res.resume();
- res.on('error', () => {});
- res.on('end', () => {
- throughput++;
- const diff = process.hrtime(start);
- if (duration > 0 && diff[0] < duration) {
- run();
- } else {
- console.log(JSON.stringify({ throughput }));
- if (client) {
- client.destroy();
- }
- }
- });
-}
-
-function run() {
- if (http.get) { // HTTP
- http.get(url, request);
- } else { // HTTP/2
- const client = http.connect(url);
- client.on('error', (e) => { throw e; });
- request(client.request(), client);
- }
-}
-
-run();