chaos icon indicating copy to clipboard operation
chaos copied to clipboard

[RFC] Optimize the Binaries

Open mertyildiran opened this issue 3 years ago • 0 comments

The chaos binary and the binaries produced by the Chaos compiler requires certain optimizations:

GCC Common Function Attributes

Using the Common Function Attributes like cold, hot, flatten, always_inline, used, unused etc. the functions in Chaos language's source needs to be optimized. These attributes can also be used in the generated intermediate C code if they are applicable.

GCC Optimize Options

Using the Optimize Options like -O3 the binaries produced by the project needs to be optimized. The Chaos compiler GCC commands supports extra flags using -e flag. For example: -e "-ggdb" So it's open to discussion that should -O3 included to the GCC commands by default or let the users decide.

Unused Functions

Move unused functions (if there are any) or global declarations to other files if they are not used by the compiled Chaos programs.

Strip

Should we strip the binaries with -s flag to reduce the binary size?

Structs & Allocations

Remove the unused members of structs in the language's source or disable them using macros according to the related case. Determine not freed or freed with an unnecessary delay memory allocations and fix them.

More optimization ideas can be extracted from Extensions to the C Language Family documentation page.

mertyildiran avatar Jan 04 '21 03:01 mertyildiran