Mail Archives: djgpp/2001/02/06/14:56:45
Miguel A. Ballicora <ballicor AT msu DOT edu> wrote:
> Dear dgjpp programmers,
> I have seen on the documentation that the profiler (gprof.exe) can give
> an advice on how to sort the functions in the executable for speed
> optimization. It gives me a list with all the functions. How do I
> achieve that sorting on the executable?
I don't think it makes any sense to even try. Except for situation
which other compiler optimizations already should have taken care of,
the relative position of functions in address space doesn't make any
difference at all on x86 processors in 32 bit flat mode and using GCC.
The borderline cases would be very short functions very close to each
other, which would reduce the 1st level cache footprint by a tiny bit
if two or more of them fit into a single cache bucket.
In a nutshell: forget it, there's nothing to be gained from this
optimization, on this platform.
> Do I have to place the function definitions in the same order in one
> file.c when I compile?
If you want to achieve that sorting: yes. The order of .o files in
your command line would also be important.
> Is djgpp going to follow that sorting?
Yes. The DJGPP linker doesn't reorder objects itself.
> Do I have to turn on or off any
> optimization flag?
Of course not. That would be against the goal of the whole exercise.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -