node
node copied to clipboard
doc: add instructions about using Visual Studio
I am not sure why but locally using vcbuild.bat never gives me real incremental builds - I am on a fairly old laptop, running vcbuild.bat again on an already built project would still try to rebuild the binary and take ~15min to finish even if I do not change the source code at all (IIRC this was also the case ~5 years ago when I still used Windows for a while). It also floods the shell with warnings and buries any compilation errors in the warnings. On the other hand when I load node.sln into Visual Studio I am able to have better incremental build (if I do not change anything it takes <1min for it to finish the process. If I only touch some .cc files it also only takes around 1min to finish building) and the warnings are minimal, allowing me to actually see compilation errors. So I think it's worth mentioning how to use Visual Studio for people developing on Windows.
Did you try vcbuild.bat noprojgen? To avoid rerunning the configure script, which may be one of the reasons it recompiles stuff.
Did you try vcbuild.bat noprojgen?
I tried running with noprojgen in a project that has not been changed and it still did a bunch of building and took ~8 minutes to complete. On the other hand, building again in Visual Studio in a project with no source changes took 2 seconds to recognize that there is no changes. Adding a comment in node.cc and building it again took ~40 seconds.
cc @nodejs/platform-windows @nodejs/build
I tested on my machine. I was using the latest main, so ClangCL was forced, but I can rerun it with the v23 branch (or a bit older main) to see if MSVC makes any difference. Here is what I found:
- Running
vcbuild.batfor the first time takes 14 minutes and 10 seconds, wheremsbuild node.sln ...takes 14 minutes - Running it for the second time takes 55 seconds, where 45 seconds are used for the
msbuildcommand - Running it another time with
noprojgencuts down time to a bit under 30 seconds, where the majority of the time is used for executing themsbuildcommand - Running the build from VS takes 1-2 seconds if it is already built.
On another note, when I run the build for the second time (regardless of noprojgen usage), I see no warnings or anything similar. This is the output of the build:
histogram.vcxproj -> ..\..\out\Release\lib\histogram.lib
abseil.vcxproj -> ..\..\out\Release\lib\abseil.lib
v8_libbase.vcxproj -> ..\..\out\Release\lib\v8_libbase.lib
icuucx.vcxproj -> ..\..\out\Release\lib\icuucx.lib
icui18n.vcxproj -> ..\..\out\Release\lib\icui18n.lib
v8_libplatform.vcxproj -> ..\..\out\Release\lib\v8_libplatform.lib
v8_zlib.vcxproj -> ..\..\out\Release\lib\v8_zlib.lib
highway.vcxproj -> ..\..\out\Release\lib\highway.lib
simdutf.vcxproj -> ..\..\out\Release\lib\simdutf.lib
nbytes.vcxproj -> ..\..\out\Release\lib\nbytes.lib
ncrypto.vcxproj -> ..\..\out\Release\lib\ncrypto.lib
zlib.vcxproj -> ..\..\out\Release\lib\zlib.lib
llhttp.vcxproj -> ..\..\out\Release\lib\llhttp.lib
cares.vcxproj -> ..\..\out\Release\lib\cares.lib
libuv.vcxproj -> ..\..\out\Release\lib\libuv.lib
icutools.vcxproj -> ..\..\out\Release\lib\icutools.lib
uvwasi.vcxproj -> ..\..\out\Release\lib\uvwasi.lib
genccode.vcxproj -> ..\..\out\Release\\genccode.exe
node_js2c.vcxproj -> out\Release\\node_js2c.exe
icudata
nghttp2.vcxproj -> ..\..\out\Release\lib\nghttp2.lib
ada.vcxproj -> ..\..\out\Release\lib\ada.lib
generating object code for ../../deps/icu-tmp/icudt77l.dat
genccode: using architecture cpu=34404 bits=64 big-endian=0
simdjson.vcxproj -> ..\..\out\Release\lib\simdjson.lib
brotli.vcxproj -> ..\..\out\Release\lib\brotli.lib
icudata.vcxproj -> ..\..\out\Release\lib\icudata.lib
sqlite.vcxproj -> ..\..\out\Release\lib\sqlite.lib
zstd.vcxproj -> ..\..\out\Release\lib\zstd.lib
bytecode_builtins_list_generator.vcxproj -> ..\..\out\Release\\bytecode_builtins_list_generator.exe
torque_base.vcxproj -> ..\..\out\Release\lib\torque_base.lib
torque.vcxproj -> ..\..\out\Release\\torque.exe
crdtp.vcxproj -> ..\..\out\Release\lib\crdtp.lib
zlib_inflate_chunk_simd.vcxproj -> ..\..\out\Release\lib\zlib_inflate_chunk_simd.lib
Assemble
Assemble
Assemble
zlib_adler32_simd.vcxproj -> ..\..\out\Release\lib\zlib_adler32_simd.lib
Assemble
Assemble
Assemble
Assemble
Assemble
Assemble
Assemble
Assemble
Assemble
Assemble
Assemble
Assemble
Assemble
Assemble
Assemble
Assemble
Assemble
Assemble
Assemble
Assemble
Assemble
Assemble
Assemble
Assemble
Assemble
Assemble
Assemble
Assemble
Assemble
openssl.vcxproj -> ..\..\out\Release\lib\openssl.lib
openssl-cli.vcxproj -> ..\..\out\Release\\openssl-cli.exe
v8_init.vcxproj -> ..\..\out\Release\lib\v8_init.lib
v8_initializers_slow.vcxproj -> ..\..\out\Release\lib\v8_initializers_slow.lib
node_js2c
gen-regexp-special-case.vcxproj -> ..\..\out\Release\\gen-regexp-special-case.exe
run_gen-regexp-special-case_action
libnode.vcxproj -> out\Release\lib\libnode.lib
Assembling ..\..\deps\v8\src\heap\base\asm\x64\push_registers_masm.asm...
v8_base_without_compiler.vcxproj -> ..\..\out\Release\lib\v8_base_without_compiler.lib
v8_compiler.vcxproj -> ..\..\out\Release\lib\v8_compiler.lib
v8_initializers.vcxproj -> ..\..\out\Release\lib\v8_initializers.lib
mksnapshot.vcxproj -> ..\..\out\Release\\mksnapshot.exe
generating: "..\..\out\Release\obj\v8_snapshot\/snapshot.cc" "..\..\out\Release\obj\v8_snapshot\/embedded.S"
v8_snapshot.vcxproj -> ..\..\out\Release\lib\v8_snapshot.lib
node_mksnapshot.vcxproj -> out\Release\\node_mksnapshot.exe
node_mksnapshot
node.vcxproj -> out\Release\\node.exe
I am running into the slowness issue again. @targos @StefanStojanovic do you mind reviewing the changes? If it's not supported to add it into the docs I am happy to just close it and publish it as a blog post instead, so that I don't forget how to do it the next time I had to build on Windows.