Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bootstrap: optimize modules loaded in the built-in snapshot #45849

Closed
wants to merge 15 commits into from

Commits on Dec 13, 2022

  1. Configuration menu
    Copy the full SHA
    b801b22 View commit details
    Browse the repository at this point in the history
  2. bootstrap: include event_target into the built-in snapshot

    Since the module has to be loaded during bootstrap anyway.
    joyeecheung committed Dec 13, 2022
    Configuration menu
    Copy the full SHA
    43db8f8 View commit details
    Browse the repository at this point in the history
  3. modules: move modules/cjs/helpers.js to modules/helpers.js

    The helpers are actually shared by the two loaders, so move them
    under modules/ directly.
    joyeecheung committed Dec 13, 2022
    Configuration menu
    Copy the full SHA
    b9509a1 View commit details
    Browse the repository at this point in the history
  4. lib: add getLazy() method to internal/util

    This patch adds a getLazy() method to facilitate initialize-once
    lazy loading in the internals.
    joyeecheung committed Dec 13, 2022
    Configuration menu
    Copy the full SHA
    9c65244 View commit details
    Browse the repository at this point in the history
  5. lib: lazy-load deps in source_map_cache.js

    So that the file can be snapshotted.
    joyeecheung committed Dec 13, 2022
    Configuration menu
    Copy the full SHA
    30e18ee View commit details
    Browse the repository at this point in the history
  6. lib: lazy-load deps in modules/run_main.js

    So that the file can be snapshotted
    joyeecheung committed Dec 13, 2022
    Configuration menu
    Copy the full SHA
    e263a61 View commit details
    Browse the repository at this point in the history
  7. modules: move callbacks and conditions into modules/esm/utils.js

    This moves the following utils into modules/esm/utils.js:
    
    - Code related to default conditions
    - The callbackMap (which is now created in the module instead of
      hanging off the module_wrap binding, since the C++ land
      does not need it).
    - Per-isolate module callbacks
    
    These are self-contained code that can be included into the
    built-in snapshot.
    joyeecheung committed Dec 13, 2022
    Configuration menu
    Copy the full SHA
    ae5d36c View commit details
    Browse the repository at this point in the history

Commits on Dec 14, 2022

  1. bootstrap: make CJS loader snapshotable

    This patch makes the top-level access to runtime states in the
    CJS loader lazy, and move the side-effects into a
    initializeCJS() function that gets called during pre-execution.
    As a result the CJS loader can be included into the built-in
    snapshot.
    joyeecheung committed Dec 14, 2022
    Configuration menu
    Copy the full SHA
    203164b View commit details
    Browse the repository at this point in the history
  2. bootstrap: optimize modules loaded in the built-in snapshot

    Preload essential modules and lazy-load non-essential ones.
    After this patch, all modules listed by running this snippet:
    
    ```
    const list = process.moduleLoadList.join('\n');
    require('fs').writeSync(1, list, 'utf-8');
    ```
    
    (which is roughly the same list as the one in
    test-bootstrap-module.js for the main thread)
    are loaded from the snapshot so no additional compilation cost
    is incurred.
    joyeecheung committed Dec 14, 2022
    Configuration menu
    Copy the full SHA
    f3b3652 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    8d57732 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    0c7011a View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    cf4681e View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    e8a4b5e View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    faa6501 View commit details
    Browse the repository at this point in the history

Commits on Dec 15, 2022

  1. Configuration menu
    Copy the full SHA
    adcd3d2 View commit details
    Browse the repository at this point in the history