[fpc-pascal]Profiling and classes

Peter Vreman peter at freepascal.org
Sun Mar 30 20:52:22 CEST 2003

> Hi all, I am trying to write a basic object-oriented matrix library, but
> have
> run into a problem.
> I expected my OO routines to be somewhat slower than my equivalent non-OO
> routines, which was also the case (the non-OO routines uses 10 sec for a
> 500x500 matrix inversion, while the OO routines uses 110 secs (!) for the
> same).

Which compiler did you use? Which OO model did you use?

If the answers are 1.0.6 and class then you should try the 1.1 compiler
and add {$implicitexceptions off}

> Each sample counts as 0.01 seconds.
>   %   cumulative   self              self     total
>  time   seconds   seconds    calls   s/call   s/call  name
>  40.63     14.13    14.13 249874780     0.00     0.00  _SIMPLE..
> [snip - a lot of lines]
>   0.00     34.78     0.00        1     0.00    34.75  program_init
> Here the cumulative seconds only shows 34.78 seconds, even though the
> output
> from "time" gives 110 seconds...
> Can anyone tell me what is going on? I guess it means that it uses a lot
> of
> time (~70%) in some internal FPC routines I have no control over?

gprof does not know any difference between your own routines or FPC
routines. If you want to know the profile results of the internal routines
you have to rebuild the RTL with -pg as option. "make OPT=-pg" in the rtl/

More information about the fpc-pascal mailing list