public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Suggestions for improving efficiency
@ 2020-12-04 12:28 Emile Michel Hobo
  2020-12-04 14:23 ` Segher Boessenkool
  0 siblings, 1 reply; 2+ messages in thread
From: Emile Michel Hobo @ 2020-12-04 12:28 UTC (permalink / raw)
  To: gcc-help

Dear GNU Project:

I don’t know whether this is already a part of your programming, but when I look at the size of programs and operating systems it seems to have gotten out of hand.

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.

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.

I don’t know whether through internal network protocols it’s necessary to call functions directly. You might also have programmers specify that functions are "necessary" in case they should always be compiled so they can be called by external programs, but I suspect this isn’t necessary because you always make use of a network protocol, meaning that you would also have a function that reads the network-input and calls the function in that way.

I hope this helps.

All the best,


Emile M. Hobo
Diezestraat 75
7523SL Enschede
The Netherlands

T +31(0)620126746
W http://www.emilehobo.nl/


VIRTVS • IVS • LEX : NON FRATERNITAM SCIO


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Suggestions for improving efficiency
  2020-12-04 12:28 Suggestions for improving efficiency Emile Michel Hobo
@ 2020-12-04 14:23 ` Segher Boessenkool
  0 siblings, 0 replies; 2+ messages in thread
From: Segher Boessenkool @ 2020-12-04 14:23 UTC (permalink / raw)
  To: Emile Michel Hobo; +Cc: gcc-help

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-04 14:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-04 12:28 Suggestions for improving efficiency Emile Michel Hobo
2020-12-04 14:23 ` Segher Boessenkool

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).