aboutsummaryrefslogtreecommitdiff
path: root/bench/fetch/node.mjs
blob: f61eeb0c62b87ea81a8bd56e0785002451917df8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { bench, run } from "mitata";

const count = 100;

bench(`fetch(https://example.com) x ${count}`, async () => {
  const requests = new Array(count);

  for (let i = 0; i < requests.length; i++) {
    requests[i] = fetch(`https://www.example.com/?cachebust=${i}`).then((r) =>
      r.text()
    );
  }

  await Promise.all(requests);
});

await run();