On 2008-03-12, J|rgen Bvhm <jboehm@[EMAIL PROTECTED]
> 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.


|