Skip to content

Conversation

wisniewskij
Copy link

Summary

As mentioned in #8259 CSS implementation had a big impact on the binary size due to its extensive use of C++ templates. Current binary size is 6.4MB and this PR adds compilation flags to bring it down. The result size is 3.1MB

Added flags:

  • -flto: enables Link Time Optimization -- compiler generates intermediate code that can be used during the linking stage to optimize size of the binary.
  • --icf=safe: enables Identical Code Folding -- this linker option reduces the binary size by merging identical functions or read-only data sections, optimizing memory usage. The safe mode works in a way that should not alter program's behavior: If the program, or any external systems interacting with the program, depend on the specific memory addresses of functions or data, --icf=safe should maintain these dependencies correctly, avoiding alterations that could affect functionality based on memory layout.

@wisniewskij
Copy link
Author

It might be a good idea to use lto only in the release build as the intermediate code it produces can make stepping through code while debugging harder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant