GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — node/benchmark/_test-double-benchmarker.js at main · windwiny/node Expand file tree/ Copy path_test-double-benchmarker.jsMore file actions 54 lines (46 loc) · 1.12 KB / Copy path_test-double-benchmarker.jsFile metadata and controls54 lines (46 loc) · 1.12 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 'use strict'; const myModule = process.argv[2]; if (!['http', 'https', 'http2'].includes(myModule)) { throw new Error(`Invalid module for benchmark test double: ${myModule}`); } let options; if (myModule === 'https') { options = { rejectUnauthorized: false }; } const http = require(myModule); const duration = +process.env.duration; 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 [sec, nanosec] = process.hrtime(start); const ms = sec * 1000 + nanosec / 1e6; if (ms < duration * 1000) { run(); } else { console.log(JSON.stringify({ throughput })); if (client) { client.destroy(); process.exit(0); } } }); } function run() { if (http.get) { // HTTP or HTTPS if (options) { http.get(url, options, request); } else { http.get(url, request); } } else { // HTTP/2 const client = http.connect(url); client.on('error', () => {}); request(client.request(), client); } } run(); |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |