workerd icon indicating copy to clipboard operation
workerd copied to clipboard

create compile caches on compile step

Open anonrig opened this issue 1 year ago • 0 comments

Work in progress.

The goal of this pull-request is to create an intermediary step between TypeScript compiler and Workerd compilation step to create compile caches. Compile caches will be used by the main binary to improve the startup time of the built-in modules (and only the built-ins).

Technical details:

The newly introduced binary accepts a string to the path of a file list that contains every path to be compile cached. With the current change the build process will slightly change to the following:

  1. Workerd runs typescript and compiles TS files.
  2. Each node.js built-in will be passed to the newly introduced binary to create a compile cache for the given paths.
  3. Workerd will be compiled and it will use the compile cache output from the creator binary if exists.

Limitations:

  • Currently, we only enable it for Linux. We can enable it for Windows, but since we're only using Linux on production, I don't think it's beneficial to support Windows.
  • We need to handle downstream repository and the isolate creation differences.

anonrig avatar Oct 25 '24 20:10 anonrig