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

build: speedup compilation of mksnapshot output #48162

Merged
merged 1 commit into from
Jun 1, 2023

Commits on May 25, 2023

  1. build: speed up compilation of mksnapshot output

    Incremental compilation of Node.js is slow. Currently on a powerful
    Linux machine, it takes about 5.8 seconds to compile
    `gen/node_snapshot.cc` with g++.
    
    As in the previous PR which dealt with `node_js2c`, we add a new build
    define `NODE_MKSNAPSHOT_USE_STRING_LITERALS` which is used by
    `node_mksnapshot`. When this flag is set, we emit string literals
    instead of array literals for the snapshot blob and for the code cache,
    i.e.:
    
    ```c++
    // old: static const uint8_t X[] = { ... };
    static const uint8_t *X = "...";
    ```
    
    I only enabled the new flag on Linux/macOS, since those are systems that
    I have available for testing. On my Linux system with gcc, it speeds up
    compilation of this file by 3.7s (5.8s -> 2.1s). On my Mac system with
    clang, it speeds up compilation by 1.7s (3.4s -> 1.7s).
    
    Again, the right thing here is probably to generate separate files for
    the snapshot blob and for each code cache output, but this is a nice
    intermediate speedup.
    
    Refs: nodejs#47984
    Refs: nodejs#48160
    kvakil committed May 25, 2023
    Configuration menu
    Copy the full SHA
    3836ab5 View commit details
    Browse the repository at this point in the history