From 32cde82f97c1d2b4836bb85fe479cdd5ea508c23 Mon Sep 17 00:00:00 2001 From: Cong Zhang <13283869+congzhangzh@users.noreply.github.com> Date: Fri, 22 Mar 2024 01:06:48 +0800 Subject: [PATCH 1/3] doc: add mold to speeding up section --- BUILDING.md | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index 53f636a4cf641e..55fb85dcc90f29 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -531,23 +531,27 @@ make test-only #### Speeding up frequent rebuilds when developing +Tips: The `ccache` utility is widely used and should generally work fine. If you encounter any difficulties, consider disabling `mold` as a troubleshooting step. + 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: +installing `ccache` and `mold` can help to greatly reduce build times. Set up with: On GNU/Linux: ```bash -sudo apt install ccache # for Debian/Ubuntu, included in most Linux distros -export CC="ccache gcc" # add to your .profile -export CXX="ccache g++" # add to your .profile +sudo apt install ccache mold # for Debian/Ubuntu, included in most Linux distros +export CC="ccache gcc" # add to your .profile +export CXX="ccache g++" # add to your .profile +export LDFLAGS="-fuse-ld=mold" # add to your .profile ``` On macOS: ```bash -brew install ccache # see https://brew.sh -export CC="ccache cc" # add to ~/.zshrc or other shell config file -export CXX="ccache c++" # add to ~/.zshrc or other shell config file +brew install ccache mold # see https://brew.sh +export CC="ccache cc" # add to ~/.zshrc or other shell config file +export CXX="ccache c++" # add to ~/.zshrc or other shell config file +export LDFLAGS="-fuse-ld=mold" # add to ~/.zshrc or other shell config file ``` This will allow for near-instantaneous rebuilds when switching branches back @@ -565,6 +569,10 @@ the specified directory. The JS debugger of Visual Studio Code supports this configuration since the November 2020 version and allows for setting breakpoints. +Refs: +1. https://ccache.dev/performance.html +2. https://github.com/rui314/mold + #### Troubleshooting Unix and macOS builds Stale builds can sometimes result in `file not found` errors while building. From a128ec71ee0a4895e8b1d26b23d0674a107f189c Mon Sep 17 00:00:00 2001 From: Cong Zhang <13283869+congzhangzh@users.noreply.github.com> Date: Sat, 23 Mar 2024 03:06:55 +0000 Subject: [PATCH 2/3] doc: format-md for speeding up section --- BUILDING.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index 55fb85dcc90f29..c43099e19e2e0c 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -569,9 +569,10 @@ the specified directory. The JS debugger of Visual Studio Code supports this configuration since the November 2020 version and allows for setting breakpoints. -Refs: -1. https://ccache.dev/performance.html -2. https://github.com/rui314/mold +Refs: + +1. +2. #### Troubleshooting Unix and macOS builds From 90fe701675b902add6dd171aeab1eee9eb65180d Mon Sep 17 00:00:00 2001 From: Cong Zhang <13283869+congzhangzh@users.noreply.github.com> Date: Sat, 23 Mar 2024 08:47:08 +0000 Subject: [PATCH 3/3] doc: fix lint-md failed --- BUILDING.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index c43099e19e2e0c..a4e910aba39cca 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -531,10 +531,13 @@ make test-only #### Speeding up frequent rebuilds when developing -Tips: The `ccache` utility is widely used and should generally work fine. If you encounter any difficulties, consider disabling `mold` as a troubleshooting step. +Tips: The `ccache` utility is widely used and should generally work fine. +If you encounter any difficulties, consider disabling `mold` as a +troubleshooting step. -If you plan to frequently rebuild Node.js, especially if using several branches, -installing `ccache` and `mold` can help to greatly reduce build times. Set up with: +If you plan to frequently rebuild Node.js, especially if using several +branches, installing `ccache` and `mold` can help to greatly reduce build +times. Set up with: On GNU/Linux: