Related articles |
---|
Code size as a function of source size jboehm@gmx.net (=?ISO-8859-1?Q?J=FCrgen_B=F6hm?=) (2008-03-12) |
Re: Code size as a function of source size marcov@stack.nl (Marco van de Voort) (2008-03-14) |
Re: Code size as a function of source size barry.j.kelly@gmail.com (Barry Kelly) (2008-03-14) |
Re: Code size as a function of source size SidTouati@inria.fr (Sid Touati) (2008-04-22) |
From: | Marco van de Voort <marcov@stack.nl> |
Newsgroups: | comp.compilers |
Date: | Fri, 14 Mar 2008 10:30:09 +0000 (UTC) |
Organization: | Stack Usenet News Service |
References: | 08-03-050 |
Keywords: | code, analysis |
Posted-Date: | 14 Mar 2008 12:06:16 EDT |
On 2008-03-12, J|rgen Bvhm <jboehm@gmx.net> wrote:
> I would like to pose a very simple question, for which nevertheless I
> could not find an answer through google:
>
> Of what general type is the dependence of the size of compiled code
> to the size of the respective source code?
Just to give an idea of a possible approximation to get a discussion
started:
code := FactorA * lines + func(lines,total library size) + FactorC.
The first term is the own code you write, roughly lineair with the size of
lines. The FactorA constant depends on language, style etc.
The last term is the minimal size of the runtime library and other overhead
(e.g. the header of the binary format, relocations etc)
The second term is the effect that on average large code uses a larger part
of the optional routines of the libraries.
However this is a function depending on, amongst others, coding style (e.g.
code that only calculates will use a relative small part of the runtime),
how standalone the average routine in the runtime is, how good the compiler
is in smartlinking etc. Usually this looks like a log function, but then
asymptotic to the total library size (since eventually everything is linked
in)
A complicating factor is functionality like templates that can cause (for
some languages) parts of the library to be instantiated multiple times. But
even then goes that eventually the most used templates will be instantiated
for the most used types, and the second term gets less dependant on program
lines.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.