summaryrefslogtreecommitdiff
path: root/tools/bench/README.md
blob: 78529d1063837e0340ea21fd4c0bc2512cfd433e (plain)
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
## Re-bootstrapping

Re-bootstrapping allows deno devs to bench/profile/test JS-side changes without
doing a full `cargo build --release --bin deno` which takes roughly ~4mn on M1s
more on other machines which significantly slows down iteration &
experimentation.

## Example

```js
import { benchSync, rebootstrap } from "./tools/bench/mod.js";

const bootstrap = rebootstrap([
  "webidl",
  "console",
  "url",
  "web",
  "fetch",
]);

benchSync("resp_w_h", 1e6, () =>
  new bootstrap.fetch.Response("yolo", {
    status: 200,
    headers: {
      server: "deno",
      "content-type": "text/plain",
    },
  }));
```

This code can then benched and profiled (using Chrome's DevTools) similar to
regular userland code and the original source files appear in the DevTools as
you would expect.