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: make build faster (at least on Windows) #12281

Closed
5 of 8 tasks
refack opened this issue Apr 8, 2017 · 22 comments
Closed
5 of 8 tasks

build: make build faster (at least on Windows) #12281

refack opened this issue Apr 8, 2017 · 22 comments
Assignees
Labels
build Issues and PRs related to build files or the CI. windows Issues and PRs related to the Windows platform.

Comments

@refack
Copy link
Contributor

refack commented Apr 8, 2017

  • Version: *
  • Platform: Windows
  • Subsystem: build

The problem: even for minor changes building on Windows can take 10s of minutes.
This issue is for tracking several approaches to mitigate that.

  • make GYP less aggressive in recreating *.*proj files
  • better signaling to VS of the minimal change set
  • use compiler cache
  • make using ninja simpler
  • allow for debug build to use /lib/ files as is (skip mksnapshot)
  • shortcut the ICU toolchain
  • allow decoupling of /deps/ from main executable compilation & linking
  • easy way to cloud-source parts of the compilation
@refack refack added build Issues and PRs related to build files or the CI. discuss Issues opened for discussions and feedbacks. windows Issues and PRs related to the Windows platform. labels Apr 8, 2017
@refack
Copy link
Contributor Author

refack commented Apr 8, 2017

/cc @nodejs/build @nodejs/platform-windows

@refack refack self-assigned this Apr 8, 2017
@gibfahn
Copy link
Member

gibfahn commented Apr 8, 2017

vcbuild.bat could definitely do with some love, thanks for picking this up @refack!

@refack
Copy link
Contributor Author

refack commented Apr 8, 2017

🙏may the powers that be protect us from the evil that is cmd scripting

@refack
Copy link
Contributor Author

refack commented Apr 8, 2017

vcbuild.bat could definitely do with some love

Was thinking of rewriting it PowerShell

@gibfahn
Copy link
Member

gibfahn commented Apr 8, 2017

Was thinking of rewriting it PowerShell

Hmm, not sure what the rest of @nodejs/build and @nodejs/platform-windows would think of that, but it sounds like it might be a good idea to me. Fundamentally I think people would be more willing to learn and contribute to a Powershell build script than a batch one, and the tangled mess of gotos in vcbuild.bat doesn't seem particularly contributor-friendly.

Or maybe we should write it in js...

@refack
Copy link
Contributor Author

refack commented Apr 8, 2017

Actually could be js more specifically JScript. Windows does have a built in JScript runner

@refack
Copy link
Contributor Author

refack commented Apr 19, 2017

Timing example, after applying #12511 (a change in /lib/path.js)

C:\code\node>time < nul&vcbuild > nul&time < nul
The current time is: 14:07:53.76
Enter the new time: The current time is: 14:23:41.10
Enter the new time:

~16 minutes

@sam-github
Copy link
Contributor

Is that faster or slower than the before time?

@refack
Copy link
Contributor Author

refack commented Apr 19, 2017

Just an example of a recompile after just changing a .js file :(

Mean while on "Ubuntu on Windows"

refael@refaelux:/mnt/d/code/node$ time BUILDTYPE=Debug make -C out -j3
make: Entering directory '/mnt/d/code/node/out'
  ACTION Regenerating Makefile
-fmake --ignore-environment --toplevel-dir=. -I/mnt/d/code/node/common.gypi -I/mnt/d/code/node/config.gypi --depth=. -Goutput_dir=/mnt/d/code/node/out --generator-output=/mnt/d/code/node/out -Dcomponent=static_library -Dlibrary=static_library -Dlinux_use_bundled_binutils=0 -Dlinux_use_bundled_gold=0 -Dlinux_use_gold_flags=0 node.gyp /mnt/d/code/node/node.gyp -I /mnt/d/code/node/common.gypi -I /mnt/d/code/node/config.gypi --depth=. --generator-output /mnt/d/code/node/out -Goutput_dir=/mnt/d/code/node/out -Dcomponent=static_library -Dlibrary=static_library -Dlinux_use_bundled_binutils=0 -Dlinux_use_bundled_gold=0 -Dlinux_use_gold_flags=0
  ACTION _mnt_d_code_node_node_gyp_node_js2c_host_node_js2c /mnt/d/code/node/out/Debug/obj/gen/node_javascript.cc
  TOUCH 77ac9600461e1dfdf3594f5e11b3cd135d0cbfd6.intermediate
  ACTION Generating inspector protocol sources from protocol json 77ac9600461e1dfdf3594f5e11b3cd135d0cbfd6.intermediate
  CXX(target) /mnt/d/code/node/out/Debug/obj.target/node/gen/node_javascript.o
  LINK(target) /mnt/d/code/node/out/Debug/node
rm 77ac9600461e1dfdf3594f5e11b3cd135d0cbfd6.intermediate
make: Leaving directory '/mnt/d/code/node/out'

real    1m25.091s
user    0m45.625s
sys     0m33.406s

[linux envy]

@sam-github
Copy link
Contributor

Not that much faster for me on Linux. C++ linking of Debug symbols is brutal. I worked with a program that had a 45 minute non-debug linktime once. Debug couldn't be linked, not enough memory on our machines.

@refack
Copy link
Contributor Author

refack commented Apr 19, 2017

Same scenario, just changing a .js file, but build with ninja

c:\code\node\out.ninja\out\Debug$ time < nul &echo.""&ninja -j 3 -v -f build.ninja node&time < nul
The current time is: 18:50:11.05
Enter the new time: ""
[1/5] C:\bin\dev\python27\python.exe gyp-win-tool action-wrapper environment.x64 node_js2c_target_node_js2c_bce0facc3e66b523ccf35ab2d859c2d9..rsp ..\..\..\
[2/5] C:\bin\dev\python27\python.exe gyp-win-tool stamp obj\node.actions_depends.stamp
[3/5] C:\bin\dev\python27\python.exe gyp-win-tool stamp obj\node.compile_depends.stamp
[4/5] ninja -t msvc -e environment.x64 -- "D:\bin\dev\VS\2017\BuildTools\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64\cl.exe" /nologo /showIncludes /FC @obj\gen\node.node_javascript.obj.rsp /c gen\node_javascript.cc /Foobj\gen\node.node_javascript.obj /Fdobj\node.cc.pdb
[5/5] C:\bin\dev\python27\python.exe gyp-win-tool link-with-manifests environment.x64 True node.exe "C:\bin\dev\python27\python.exe gyp-win-tool link-wrapper environment.x64 False link.exe /nologo /OUT:node.exe @node.exe.rsp" 1 mt.exe rc.exe "obj\node.node.exe.intermediate.manifest" obj\node.node.exe.generated.manifest ..\..\..\src\res\node.exe.extra.manifest
The current time is: 18:51:07.85
Enter the new time:

56 seconds. I'm in love with ninja

@gibfahn
Copy link
Member

gibfahn commented Apr 20, 2017

@refack ninja and ccache are the two things that really help with build times. I don't think ccache is available on Windows though, we use it on all our Unix test infra.

Not that much faster for me on Linux. C++ linking of Debug symbols is brutal.

@rsam I think the 16 minutes was for release mode on windows looking at the command: C:\code\node>time < nul&vcbuild > nul&time < nul

@refack
Copy link
Contributor Author

refack commented Apr 20, 2017

@rsam I think the 16 minutes was for release mode on windows looking at the command: C:\code\node>time < nul&vcbuild > nul&time < nul

On a fully pre-built tree, after changing one .js file 🤦

@sam-github
Copy link
Contributor

Ah, I though out.ninja\out\Debug meant it was debug. That is pretty awful, I'm sure Windows devs will thank you if you can improve it.

@refack
Copy link
Contributor Author

refack commented Apr 20, 2017

ccache

This is something I wanted to build myself (maybe into ninja or GYP), hash the input files and tools versions, and do a lookup into some repository (node-pre-gyp style)

@gibfahn
Copy link
Member

gibfahn commented Apr 20, 2017

@refack maybe try https://github.com/frerich/clcache ?

refack added a commit to refack/node that referenced this issue Apr 30, 2017
this is a backport of 4 gyp commits since last bump, syncing us to
https://chromium.googlesource.com/external/gyp/+/a478c1ab51ea3e04e79791ac3d1dad01b3f57434
this is instead of a bump and rebase of floating patches

the goal is to fix the ninja generator on Windows

also includes:
* windows: use "mkdir" even when copying directory

Original commit messages:

a478c1ab51ea3e04e79791ac3d1dad01b3f57434:
  win: mkdir even when copying directory

  * also "fix" the paths in the message
  * un-skip test/copies/gyptest-all.py

  BUG=gyp:536

  Change-Id: Id8ff7941b995c25d68d454138cd8b04940fdd82b
  Reviewed-on: https://chromium-review.googlesource.com/487521
  Commit-Queue: Dirk Pranke <dpranke@chromium.org>
  Reviewed-by: Dirk Pranke <dpranke@chromium.org>

ffd524cefaad622e72995e852ffb0b18e83f8054
  win ninja/make: Always use a native compiler executable with MSVS 2017

  A host-native executable will always be used, and it will be a cross
  compiler if the target architecture differs from the host architecture.

  BUG=683729

  Change-Id: I02a09e1755dd2ab7eca5c9d1957d7aeb56db6af6
  Reviewed-on: https://chromium-review.googlesource.com/486400
  Commit-Queue: Mark Mentovai <mark@chromium.org>
  Reviewed-by: Dirk Pranke <dpranke@chromium.org>

e8850240a433259052705fb8c56e51795b7dc9c3
  Fix MSVC++ 32-on-32 builds after b62d04ff85e6

  BUG=683729

  Change-Id: Ic8c227960b859ddc3c19fce0e98144510f5e74bf
  Reviewed-on: https://chromium-review.googlesource.com/486380
  Reviewed-by: Dirk Pranke <dpranke@chromium.org>
  Commit-Queue: Mark Mentovai <mark@chromium.org>

b62d04ff85e6234e4fec7fff9377dd96c09d41a7
  win,ninja: ninja generator better on windows

  * add compatibility with VS2017
  * adjust `_TargetConfig` and `/FS` for VS2017 compat
  * find new place of `vcvarsall.bat` in VS2017
  * normalize "path like" arguments of actions
  * better check for `.lib` and `.def` file names

  BUG=683729

  Change-Id: I123bff7bd8a0011cf65d27a62b5267ba884e3b42
  Reviewed-on: https://chromium-review.googlesource.com/482580
  Reviewed-by: Dirk Pranke <dpranke@chromium.org>
  Reviewed-by: Mark Mentovai <mark@chromium.org>
  Commit-Queue: Dirk Pranke <dpranke@chromium.org>

Ref: nodejs#12281
PR-URL: nodejs#12632
@Trott
Copy link
Member

Trott commented Aug 2, 2017

Should this remain open? If so, does it make sense to make it a tracking issue with some check boxes so it's obvious at a glance what parts are done and what parts aren't?

@refack
Copy link
Contributor Author

refack commented Aug 2, 2017

Don't triagathon me 👼
Yes, I'll break break this up. I have several better defined sub-tasks in mind.

@refack
Copy link
Contributor Author

refack commented Aug 2, 2017

/cc @nodejs/platform-windows now that we've grown in numbers, and at @Trott's behest, I've broken this issue down to several more tractable tasks. I'd be happy if we all pitched in (I've given most of the tasks some thought, but not enough work, so I'd be happy to discuss each of them).

@tniessen
Copy link
Member

tniessen commented Aug 3, 2017

I would prefer Powershell over JScript.

@refack
Copy link
Contributor Author

refack commented Aug 3, 2017

I would prefer Powershell over JScript.

Yep, that's #12310 (I'm 80% there, just 80% more left) - https://gist.github.com/refack/969ecc6642981bfd7caef7d948d78076

@Trott Trott removed the discuss Issues opened for discussions and feedbacks. label Mar 11, 2018
@jasnell
Copy link
Member

jasnell commented Jun 25, 2020

There's been no further discussion in years with no clear action here. Closing.

@jasnell jasnell closed this as completed Jun 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

No branches or pull requests

6 participants