MCPcopy Index your code
hub / github.com/nodejs/node / main

Function main

benchmark/http/headers.js:24–52  ·  view source on GitHub ↗
({ len, n, duration })

Source from the content-addressed store, hash-verified

22}, { byGroups: true });
23
24function main({ len, n, duration }) {
25 const headers = {
26 'Connection': 'keep-alive',
27 'Transfer-Encoding': 'chunked',
28 };
29
30 const Is = [...Array(n / len).keys()];
31 const Js = [...Array(len).keys()];
32
33 for (const i of Is) {
34 headers[`foo${i}`] = Js.map(() => `some header value ${i}`);
35 }
36
37 const server = http.createServer((req, res) => {
38 res.writeHead(200, headers);
39 res.end();
40 });
41
42 server.listen(0, () => {
43 bench.http({
44 path: '/',
45 connections: 10,
46 duration,
47 port: server.address().port,
48 }, () => {
49 server.close();
50 });
51 });
52}

Callers

nothing calls this directly

Calls 9

ArrayFunction · 0.85
writeHeadMethod · 0.80
listenMethod · 0.80
httpMethod · 0.80
keysMethod · 0.65
mapMethod · 0.65
addressMethod · 0.65
closeMethod · 0.65
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…