[fpc-pascal]General Question on code optimization...

Rainer Hantsch rainer at hantsch.co.at
Tue Oct 7 17:09:33 CEST 2003

On Tue, 7 Oct 2003, Marco van de Voort wrote:
| I think the best thing would be to find out what exactly hinders newer
| FPC versions, make a few mods and compile a matching version locally.

Are you talking about compiling a local FPC version, or about changing the
mysql unit?
I never compiled my own FPC in the past and I am not really happy with the
thought to start with that. :-/

But back to the basic question:

Shouldn't FreePascal automatically skip all code which is not required/used?
Especially in a procedural environment it should be relatively easy to find
out at compile time, which functions/procedures are used or not.
So the compiler should be able -- especially when the unit source is present
-- to build code which only contains that what is really used. Isn't it?

Instead, the compiler/linker/whatever seems to process the whole unit,
regardless if portions of it are not used, and something drops over a
problematic procedure even if this is not used at all! :-/

Does FPC include a whole unit with hundreds of procedures if I use only one
(or none) of them? This would not be very smart!

I have absolutely no knowledge about how FPC internally works, which explains
how good it works at all. (There simply is no need to fiddle around inside
of it, it covers everything perfectly.) But there are some things which could
(possibly) be made a little bit better... And one thing is that it could
(possibly) resolve all dependices in a first pass and then only process that
parts which are actually used.


  Ing. Rainer Hantsch

|      \\|//              Ing. Rainer HANTSCH  -  Hardware + Software |
|      (o o)        Service - Support - WEB-Design und Programmierung |
| Ing. Rainer HANTSCH |  mail: office at hantsch.co.at                   |
| Khunngasse 21/20    |   www: http://www.hantsch.co.at               |
| A-1030 Vienna       |   tel: +43-1-79885380    fax: +43-1-798853818 |
| ** A u s t r i a ** | handy: +43-664-9194382   UID-Nr: ATU 11134002 |

More information about the fpc-pascal mailing list