Skip to content

Enable LTO #110

@springmeyer

Description

@springmeyer

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions