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

Enable LTO #110

Closed
springmeyer opened this issue Mar 1, 2018 · 2 comments
Closed

Enable LTO #110

springmeyer opened this issue Mar 1, 2018 · 2 comments

Comments

@springmeyer
Copy link
Contributor

springmeyer commented Mar 1, 2018

For projects that use node-cpp-skel and end up having lots of .cpp files, LTO starts to become potentially important for best performance per https://github.com/mapbox/cpp/blob/master/glossary.md#link-time-optimization.

This ticket tracks getting an LTO example working in node-cpp-skel that other modules can follow. This is worthwhile but a little hairy since it requires:

  • the same compiler to be used for compiling all binaries (tricky with mason unless you ask mason to source compile)
  • it requires upgrading binutils from mason to use the "gold" linker within binutils for linux

Ideally as part of this effort we also document an exact, measurable situation when LTO actually helps. Having it help performance in theory is not worth the setup overhead, so we'll want to have a clear demonstration it helps perf. Although one caveat is that we should likely investigate using -fsanitize=cfi in production in the future and that requires LTO: (https://blog.trailofbits.com/2016/10/17/lets-talk-about-cfi-clang-edition/ and https://clang.llvm.org/docs/ControlFlowIntegrity.html).

Related:

@springmeyer
Copy link
Contributor Author

now enabled after 93edf4f

@springmeyer
Copy link
Contributor Author

Ideally as part of this effort we also document an exact, measurable situation when LTO actually helps.

Never did this. Still worthwhile. The reason I merged without doing a perf validation benchmark is that:

  1. I noticed that adding -flto can catch ODR errors that are otherwise silent. So making sure we can compile with LTO increases the robustness of the code
  2. I wanted to support fsanitize=cfi which requires it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant