Re: BDS2006 exe sizes



"Ian" <ian610@xxxxxxxxxxxxxxxx> wrote in message
news:NyULf.2303$EA6.896@xxxxxxxxxxxxxxxxxxxxxxxx
[...]
I believe an efficient compiler would take even the smallest program
and optimize it and produce the smallest executable possible.

The arguments against that have been stated over and over. First of all,
the compiler _does_, and the actual code for "WriteLn('Hello world')"
already is quite small. It's the linker that then produces a Portable
Executable-formatted file that the OS can actually load and run, and
that other OSes cannot load and run, but in a controlled manner that
allows them to display "This program requires Microsoft Windows", for
example.


I'm not an expert on compilers, but

Hold that thought.

It might be a nice exercise to build a compiler yourself some time.
I did once, in university, and it was a great experience. There is an
immense sense of power and achievement in it. Even when you realise
that the compiler you're building it with is taking care of all the
gritty details like wrapping an actual program in code that makes it
callable from the OS and takes care of what actually happens with the
output. Roughly, providing the linker and (part of) the RTL. More than
you might think.


I just don't understand why 32-bit
Pascal/Delphi compilers produce such large exes for such simple
programs. Even without the SysUtils unit included, I feel the exe's
could still be more compact (maybe 5k?).

They might be, but it would probably require compaction/optimisation
techniques that apply only to very small, effectively uninteresting
programs. Would you thank Borland for spending their time on that?

Don't lose sight of the fact that "uses Forms, SysUtils" turns any
program into a nontrivial one instantly. SysUtils for instance loads
a slew of variables with your regional settings. That takes up space
both for the variables and for the code that initialises them. Forms
creates an Application variable which pulls in the entire TApplication
class. It derives from TComponent, that alone should tell you enough.

I think Forms also includes loads of initialisation code to couple
forms with IDE designers - or not, as the case may be, but again,
would you thank Borland for developing two different modules that are
both as small as physically possible, rather than one that _works_
in both cases? I know what I advocate at work. It keeps our software
reliable, which is a lot more important than "small".

Groetjes,
Maarten Wiltink


.



Relevant Pages

  • Re: The coming death of all RISC chips.
    ... I mean the x86 architecture where my code runs at optimal speed! ... the perverse alignment requirements of SSE load-op and RMW ... instructions mean that unless the compiler is totally sure that the ... I would expect load-op to be split into two micro-ops ...
    (comp.arch)
  • VS.NET quirks and rants
    ... The March Hare [MVP] wrote: ... >> to load VS 7 but your solution sounds like a better route. ... I like the compiler in VS.NET. ... strays into a VS.NET window when focus-follows-mouse is on is BLOODY ...
    (microsoft.public.win32.programmer.directx.audio)
  • Re: Library bug or my fault?
    ... The compiler is allowed to assume that p2 (which can only correctly ... point to an actual instance of a "struct Bar") is 4-byte aligned, ... store two bytes to first two bytes of "bar" ... load third byte from address given by p2+2 ...
    (comp.lang.c)
  • Re: Which name will be returned when forcing load function to treat the fig-file as a MAT-fi
    ... > Tsai wrote: ... > Why not just specify an output from LOAD: ... 1103 Functions which use the EVAL function cannot be translated into ... C or C++ code using the MATLAB Compiler. ...
    (comp.soft-sys.matlab)
  • CLX is now in CVS
    ... into the CVS tree. ... configuring ECL. ... The CLX library is compiled as a FASL module that you can load using ... A couple of bugs in the compiler had to be solved in the process of ...
    (comp.lang.lisp)