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

Unity builds #2036

Closed
3 tasks
Riolku opened this issue Sep 15, 2023 · 0 comments
Closed
3 tasks

Unity builds #2036

Riolku opened this issue Sep 15, 2023 · 0 comments

Comments

@Riolku
Copy link
Contributor

Riolku commented Sep 15, 2023

Unity builds (where we amalgamate source files before compiling) can offer compilation and runtime speedups. CMake has builtin support for it.

Tasks:

  • Ensure every header has #pragma once (this is not currently the case).
  • Enable unity builds and test them in CI.
  • Compare unity builds against normal ones and decide which to use for releases.

As for combining all the source files into one, this is generally not recommended, according to the CMake Documentation, though it is possible. It is something we could consider trying out, though the memory usage promises to be extremely high. In general, we could play around with batch sizes and see what runtime gains there are to be had.

Riolku added a commit that referenced this issue Nov 22, 2023
Link-Time Optimization is a technique whereby the linker performs
optimizations at the final step, right before generating the final
executable or shared library. This provides significant performance and
binary size optimizations, since the linker has access to all the
context needed, unlike the individual optimizer passes, but in exchange
linking takes a lot of time and memory.

Based on some reading and some experimentation, Unity Builds, though
they can offer similar benefits, are not nearly as good for
optimization, and instead are primarily used for speeding up compile
times. Additionally, Unity builds are harder to get right and harder to
debug. LTO on the other hand is a very simple change, and seems to be
the main area of focus right now.

Closes #2036.
Riolku added a commit that referenced this issue Nov 22, 2023
Link-Time Optimization is a technique whereby the linker performs
optimizations at the final step, right before generating the final
executable or shared library. This provides significant performance and
binary size optimizations, since the linker has access to all the
context needed, unlike the individual optimizer passes, but in exchange
linking takes a lot of time and memory.

Based on some reading and some experimentation, Unity Builds, though
they can offer similar benefits, are not nearly as good for
optimization, and instead are primarily used for speeding up compile
times. Additionally, Unity builds are harder to get right and harder to
debug. LTO on the other hand is a very simple change, and seems to be
the main area of focus right now.

Closes #2036.
Riolku added a commit that referenced this issue Nov 22, 2023
Link-Time Optimization is a technique whereby the linker performs
optimizations at the final step, right before generating the final
executable or shared library. This provides significant performance and
binary size optimizations, since the linker has access to all the
context needed, unlike the individual optimizer passes, but in exchange
linking takes a lot of time and memory.

Based on some reading and some experimentation, Unity Builds, though
they can offer similar benefits, are not nearly as good for
optimization, and instead are primarily used for speeding up compile
times. Additionally, Unity builds are harder to get right and harder to
debug. LTO on the other hand is a very simple change, and seems to be
the main area of focus right now.

Closes #2036.
Riolku added a commit that referenced this issue Nov 22, 2023
Link-Time Optimization is a technique whereby the linker performs
optimizations at the final step, right before generating the final
executable or shared library. This provides significant performance and
binary size optimizations, since the linker has access to all the
context needed, unlike the individual optimizer passes, but in exchange
linking takes a lot of time and memory.

Based on some reading and some experimentation, Unity Builds, though
they can offer similar benefits, are not nearly as good for
optimization, and instead are primarily used for speeding up compile
times. Additionally, Unity builds are harder to get right and harder to
debug. LTO on the other hand is a very simple change, and seems to be
the main area of focus right now.

Closes #2036.
Riolku added a commit that referenced this issue Nov 22, 2023
Link-Time Optimization is a technique whereby the linker performs
optimizations at the final step, right before generating the final
executable or shared library. This provides significant performance and
binary size optimizations, since the linker has access to all the
context needed, unlike the individual optimizer passes, but in exchange
linking takes a lot of time and memory.

Based on some reading and some experimentation, Unity Builds, though
they can offer similar benefits, are not nearly as good for
optimization, and instead are primarily used for speeding up compile
times. Additionally, Unity builds are harder to get right and harder to
debug. LTO on the other hand is a very simple change, and seems to be
the main area of focus right now.

Closes #2036.
Riolku added a commit that referenced this issue Nov 22, 2023
Link-Time Optimization is a technique whereby the linker performs
optimizations at the final step, right before generating the final
executable or shared library. This provides significant performance and
binary size optimizations, since the linker has access to all the
context needed, unlike the individual optimizer passes, but in exchange
linking takes a lot of time and memory.

Based on some reading and some experimentation, Unity Builds, though
they can offer similar benefits, are not nearly as good for
optimization, and instead are primarily used for speeding up compile
times. Additionally, Unity builds are harder to get right and harder to
debug. LTO on the other hand is a very simple change, and seems to be
the main area of focus right now.

Closes #2036.
Riolku added a commit that referenced this issue Nov 22, 2023
Link-Time Optimization is a technique whereby the linker performs
optimizations at the final step, right before generating the final
executable or shared library. This provides significant performance and
binary size optimizations, since the linker has access to all the
context needed, unlike the individual optimizer passes, but in exchange
linking takes a lot of time and memory.

Based on some reading and some experimentation, Unity Builds, though
they can offer similar benefits, are not nearly as good for
optimization, and instead are primarily used for speeding up compile
times. Additionally, Unity builds are harder to get right and harder to
debug. LTO on the other hand is a very simple change, and seems to be
the main area of focus right now.

In order to make this work on Windows, we needed a small fix to how
ANTLR4 is built.

Closes #2036.
Riolku added a commit that referenced this issue Nov 22, 2023
Link-Time Optimization is a technique whereby the linker performs
optimizations at the final step, right before generating the final
executable or shared library. This provides significant performance and
binary size optimizations, since the linker has access to all the
context needed, unlike the individual optimizer passes, but in exchange
linking takes a lot of time and memory.

Based on some reading and some experimentation, Unity Builds, though
they can offer similar benefits, are not nearly as good for
optimization, and instead are primarily used for speeding up compile
times. Additionally, Unity builds are harder to get right and harder to
debug. LTO on the other hand is a very simple change, and seems to be
the main area of focus right now.

In order to make this work on Windows, we needed a small fix to how
ANTLR4 is built.

Closes #2036.
@Riolku Riolku closed this as completed in cbfa8b0 Nov 22, 2023
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