1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-27 09:39:08 -05:00
denoland-deno/tools/bench
2023-01-13 13:42:15 -05:00
..
mod.js chore: small cleanup of scripts in ./tools and run copyright checker in lint.js (#17393) 2023-01-13 13:42:15 -05:00
README.md tools(bench): rebootstrap (#12281) 2021-10-01 00:42:24 +02:00
rebench.js chore: small cleanup of scripts in ./tools and run copyright checker in lint.js (#17393) 2023-01-13 13:42:15 -05:00
rebootstrap.js chore: small cleanup of scripts in ./tools and run copyright checker in lint.js (#17393) 2023-01-13 13:42:15 -05:00

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

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.