-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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: introduce ./configure --with-lto
#7408
Conversation
Introduce `--with-lto` configure option to use Link Time Optimization compiler pass in gcc/clang compilers. This flag slightly improves performance of C/C++ heavy code: tls/throughput.js dur="5" type="buf" size="2": ./out/Release/node-flto: 6.1295 ./out/Release/node: 5.6876 ....... 7.77% tls/throughput.js dur="5" type="buf" size="1024": ./out/Release/node-flto: 1567 ./out/Release/node: 1455 ........ 7.70% tls/throughput.js dur="5" type="buf" size="1048576": ./out/Release/node-flto: 4167.8 ./out/Release/node: 4026.7 . 3.50% tls/throughput.js dur="5" type="asc" size="2": ./out/Release/node-flto: 5.5664 ./out/Release/node: 5.0363 ...... 10.52% tls/throughput.js dur="5" type="asc" size="1024": ./out/Release/node-flto: 1462.2 ./out/Release/node: 1336.8 .... 9.38% tls/throughput.js dur="5" type="asc" size="1048576": ./out/Release/node-flto: 3947.5 ./out/Release/node: 3847.4 . 2.60% tls/throughput.js dur="5" type="utf" size="2": ./out/Release/node-flto: 5.5544 ./out/Release/node: 5.0786 ....... 9.37% tls/throughput.js dur="5" type="utf" size="1024": ./out/Release/node-flto: 1328.5 ./out/Release/node: 1255.7 .... 5.80% tls/throughput.js dur="5" type="utf" size="1048576": ./out/Release/node-flto: 3051.1 ./out/Release/node: 2985.1 . 2.21% See: nodejs#7400
It appears to be breaking I wonder if addons would still work just fine? |
hmm. side effects are weird. Nothing should pop up really.... Having this has no harm though. If that holds true, LGTM. |
btw, this fails to link for me when using gcc ( EDIT: figured out what’s going wrong, I had to set |
@@ -290,6 +291,13 @@ | |||
], | |||
'ldflags!': [ '-rdynamic' ], | |||
}], | |||
['node_use_lto=="true"', { | |||
'conditions': [ [ 'clang==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.
Can you put the condition on a separate line?
|
@indutny .. what's the status on this one? |
@jasnell seems to be breaking profiler tests, and the effects may be local to only OS X. Not sure if we want it at this time. |
Ok. do you want to keep it open to work on later or close? |
@jasnell I would keep it open, the conflicts are not going to be too hard to resolve later on. |
c133999
to
83c7a88
Compare
ping @indutny ... any updates on this? |
@indutny By the way, for me this seems to work now. Setting I have a rebased version at d6b510c (resolving the conflict here is trivial), CI results @ https://ci.nodejs.org/job/node-test-commit/7653/. Some of the CI hosts ran into the same problem I had, but the OS X tests look a bit worrying: https://ci.nodejs.org/job/node-test-commit-osx/7615/nodes=osx1010/console |
@@ -297,6 +297,11 @@ parser.add_option('--with-lttng', | |||
dest='with_lttng', | |||
help='build with Lttng (Only available to Linux)') | |||
|
|||
parser.add_option('--with-lto', | |||
action='store_true', |
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.
Tiny nit: It would be better we passed default=False
as one of the arguments to add_option
.
I'm still not sure if we should pursue this... @addaleax except for the build failures, does it provide any measurable performance benefit for you? |
@indutny I can try to run some benchmarking later, but my personal experience would be that generally LTO is worth it. |
Closing due to lack of further progress. We can reopen later if necessary |
Checklist
make -j4 test
(UNIX) orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
build
Description of change
build: introduce
./configure --with-lto
Introduce
--with-lto
configure option to use Link Time Optimizationcompiler pass in gcc/clang compilers.
This flag slightly improves performance of C/C++ heavy code:
See: #7400
R= @bnoordhuis @nodejs/collaborators