diff options
author | Momtchil Momtchev <momtchil@momtchev.com> | 2020-12-09 13:29:15 +0100 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2020-12-18 11:46:06 -0800 |
commit | 36581f1d4e8f2f9d29709daaa25e0236021f0b16 (patch) | |
tree | 138662472d6dad79a8d1d09e2522385daf7dd8d7 /BUILDING.md | |
parent | b49145f795658c7187a94897d31f665c2fbff471 (diff) | |
download | node-new-36581f1d4e8f2f9d29709daaa25e0236021f0b16.tar.gz |
doc: add two tips for speeding the dev builds
Add two important tips for novice Node.js contributors
PR-URL: https://github.com/nodejs/node/pull/36452
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'BUILDING.md')
-rw-r--r-- | BUILDING.md | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/BUILDING.md b/BUILDING.md index 1d26ec520a..6d9b26377d 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -30,6 +30,7 @@ file a new issue. * [Building the documentation](#building-the-documentation) * [Building a debug build](#building-a-debug-build) * [Building an ASAN build](#building-an-asan-build) + * [Speeding up frequent rebuilds when developing](#speeding-up-frequent-rebuilds-when-developing) * [Troubleshooting Unix and macOS builds](#troubleshooting-unix-and-macos-builds) * [Windows](#windows) * [Prerequisites](#prerequisites) @@ -527,6 +528,29 @@ $ ./configure --debug --enable-asan && make -j4 $ make test-only ``` +#### Speeding up frequent rebuilds when developing + +If you plan to frequently rebuild Node.js, especially if using several branches, +installing `ccache` can help to greatly reduce build times. Set up with: +```console +$ sudo apt install ccache # for Debian/Ubuntu, included in most Linux distros +$ ccache -o cache_dir=<tmp_dir> +$ ccache -o max_size=5.0G +$ export CC="ccache gcc" # add to your .profile +$ export CXX="ccache g++" # add to your .profile +``` +This will allow for near-instantaneous rebuilds even when switching branches. + +When modifying only the JS layer in `lib`, it is possible to externally load it +without modifying the executable: +```console +$ ./configure --node-builtin-modules-path $(pwd) +``` +The resulting binary won't include any JS files and will try to load them from +the specified directory. The JS debugger of Visual Studio Code supports this +configuration since the November 2020 version and allows for setting +breakpoints. + #### Troubleshooting Unix and macOS builds Stale builds can sometimes result in `file not found` errors while building. |