aboutsummaryrefslogtreecommitdiff
path: root/bench/fetch/bun.js
blob: 7559b467e8852f9193e6c2e6b9bb522da6dcaff7 (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();