Skip to content

build: improve build performance #27924

Closed
@bnoordhuis

Description

@bnoordhuis

A no-op build (no files changed) currently takes about 25 seconds. It should be < 1 second.

$ time make V=
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C out BUILDTYPE=Release V=
  TOUCH 164b55c604d79564ccc044dad7a9a348370196f7.intermediate
  ACTION _Users_bnoordhuis_src_v1_x_tools_v8_gypfiles_v8_gyp_v8_base_target_run_torque_action 164b55c604d79564ccc044dad7a9a348370196f7.intermediate
  TOUCH 01e7f2a1286937e70d628711040382e58d32c150.intermediate
  ACTION Generating inspector protocol sources from protocol json 01e7f2a1286937e70d628711040382e58d32c150.intermediate
  TOUCH 964af9128e18298610dbd37c8e7efa19e756f179.intermediate
  ACTION Generating node protocol sources from protocol json 964af9128e18298610dbd37c8e7efa19e756f179.intermediate
  TOUCH ed07fabe6d2426fb5f658fe6fc03c566e72b1ad9.intermediate
  ACTION generating: "/Users/bnoordhuis/src/v1.x/out/Release/obj.target/v8_snapshot/geni/embedded.S" "/Users/bnoordhuis/src/v1.x/out/Release/obj.target/v8_snapshot/geni/snapshot.cc" ed07fabe6d2426fb5f658fe6fc03c566e72b1ad9.intermediate
  CC(target) /Users/bnoordhuis/src/v1.x/out/Release/obj.target/generate_snapshot/geni/embedded.o
  CXX(target) /Users/bnoordhuis/src/v1.x/out/Release/obj.target/generate_snapshot/geni/snapshot.o
  LIBTOOL-STATIC /Users/bnoordhuis/src/v1.x/out/Release/libgenerate_snapshot.a
  LINK(target) /Users/bnoordhuis/src/v1.x/out/Release/cctest
  LINK(target) /Users/bnoordhuis/src/v1.x/out/Release/mkcodecache
  ACTION _Users_bnoordhuis_src_v1_x_node_gyp_node_target_run_mkcodecache /Users/bnoordhuis/src/v1.x/out/Release/obj/gen/node_code_cache.cc
  CXX(target) /Users/bnoordhuis/src/v1.x/out/Release/obj.target/node/gen/node_code_cache.o
  LINK(target) /Users/bnoordhuis/src/v1.x/out/Release/node
  LINK(target) /Users/bnoordhuis/src/v1.x/out/Release/node_mksnapshot
rm ed07fabe6d2426fb5f658fe6fc03c566e72b1ad9.intermediate 964af9128e18298610dbd37c8e7efa19e756f179.intermediate 01e7f2a1286937e70d628711040382e58d32c150.intermediate 164b55c604d79564ccc044dad7a9a348370196f7.intermediate
if [ ! -r node -o ! -L node ]; then ln -fs out/Release/node node; fi

real    0m25.788s
user    0m22.921s
sys     0m2.474s

(This is with warmed up disk caches. A cold build is a little slower still.)

It does a lot of things it doesn't need to do, like:

  1. Run torque for some reason.
  2. Regenerate the inspector protocol files.
  3. Recreate the snapshot.
  4. Recreate the code cache.
  5. Relink cctest.

The first four should only run if the relevant files changed. cctest should only be built/linked when executing a test target (e.g. make test.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildIssues and PRs related to build files or the CI.performanceIssues and PRs related to the performance of Node.js.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions