Re: Suggestions for improving efficiency

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Emile,

On Fri, Dec 04, 2020 at 01:28:26PM +0100, Emile Michel Hobo via Gcc-help wrote:
> I think the size of programs might be greatly reduced if when you compile a program, you only compile the functions and object-classes that are actually used by those programs, meaning that you also leave out object functions that you don’t call directly or indirectly.

Compile with -ffunction-sections -fdata-sections (or only the first of
those), and link with -Wl,--gc-sections (or just --gc-sections if you
invoke the linker directly).

> Maybe it’s also possible to run an optimizer analysis that only looks at whether it’s more efficient to compile functions as inline functions or as functions that you call. If it reduces the program size to compile specific functions as inline functions, they should be compiled as inline functions by default.

There are heuristics for this, already.  This works better if you use
profile-guided optimisation (via -fprofile-use say, or -fauto-profile).


Segher



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux