-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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, win: make LTCG optional #21186
Conversation
CI: https://ci.nodejs.org/job/node-test-pull-request/15309/ For reference, there was also similar PR for Linux: #7408 |
I can't review the code changes but +1000 on making Windows rebuilds faster! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank You.
We may want to advertise this in BUILDING.md
as well, I think.
How does it affect the performance of the resulting binary? |
To be clear, our windows releases should use |
@seishun: I did not check that yet, but surely there is some |
parser.add_option('--with-ltcg', | ||
action='store_true', | ||
dest='with_ltcg', | ||
help='Use Link Time Code Generation. This feature is only available on Windows.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest flipping the switch to --disable-windows-ltcg
(and use store-_false
) similar to:
https://github.com/nodejs/node/blob/23efa8cc0692e690fd5138f5b93ccfd4e47c2f58/configure#L509-L517
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to keep this in line with Linux - there was PR to add --with-lto
, at some point, when it will be ready that can be merged into this option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The difference is that if we want LTCG to be the default, it makes more sense to have an opt-out --without
flag so the call to python configure
could stay simple.
BTW I meant to refeance: https://github.com/nodejs/node/blob/23efa8cc0692e690fd5138f5b93ccfd4e47c2f58/configure#L525-L528
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A very blessed optimization.
But I would suggest flipping the switch semantics.
@@ -16,6 +16,7 @@ | |||
'node_use_v8_platform%': 'true', | |||
'node_use_bundled_v8%': 'true', | |||
'node_module_version%': '', | |||
'node_with_ltcg%': '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO default should be 'true'
vcbuild.bat
Outdated
@@ -15,6 +15,7 @@ cd %~dp0 | |||
set config=Release | |||
set target=Build | |||
set target_arch=x64 | |||
set ltcg=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again IMHO switch should be flipped (since default should stay to enable LTCG).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean it should be set no-ltcg=0
Since this touches For example, nodejs/node-gyp#1457 was recently opened regarding compiling addons for a different version of Node.js than was used to run node-gyp. |
@refack Setting no LTCG as the default is definitely the more developer-friendly thing to do here … we should just make sure to keep it enabled in CI? |
I agree, that's why I prefer to have an opt-out switch (LTCG on by default, switch to turn it off). |
Also if we turn this into an opt-out switch, we could keep set config_flags=--without-ltcg
vcbuild.bat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, I am also +1 on disabling LTO on Windows by default as long as we make sure it is enabled in CI.
@refack: how about making |
23efa8c
to
d7f9e50
Compare
Rebased on master. |
Updated: made LTCG disabled by default. It will be enabled for |
Test CI uses |
I'm Ok with that but it might have higher semver-ity. Definitely minor for a new option, maybe major since we are changing default behaviour. There is a tradeoff here
/CC @nodejs/platform-windows @nodejs/build Any opinions? |
Whichever we end up using for the shipped binaries (i.e., |
Made LTCG enabled for |
@refack, @bnoordhuis, @jasnell and @joyeecheung - this was changed since your reviews. Now, LTCG is off by default, enabled only for CI testing and releases. Is this ok with you? |
Disables Link Time Code Generation by default. Adds ‘ltcg’ vcbuild option to enable it. LTCG will be used by default by release and CI builds.
fd6cf18
to
f2a6b28
Compare
Rebased, new CI: https://ci.nodejs.org/job/node-test-pull-request/15636/ |
Landed in 7c45284 |
Disables Link Time Code Generation by default. Adds ‘ltcg’ vcbuild option to enable it. LTCG will be used by default by release and CI builds. PR-URL: #21186 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
Disables Link Time Code Generation by default. Adds ‘ltcg’ vcbuild option to enable it. LTCG will be used by default by release and CI builds. PR-URL: #21186 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
Add
noltcg
option to vcbuild that disables Link Time Code Generation. While clean build is only slightly faster (19 min vs 20), rebuild after change in one of the js files now takes 20 seconds instead of 2 minutes./cc @nodejs/platform-windows
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes