From: Hans-Bernhard Broeker Newsgroups: comp.os.msdos.djgpp Subject: Re: Function and File ordering and speed optimization Date: 6 Feb 2001 19:45:23 GMT Organization: Aachen University of Technology (RWTH) Lines: 39 Message-ID: <95pk8j$ft4$1@nets3.rz.RWTH-Aachen.DE> References: <3A8049B6 DOT 7C7B7BB1 AT msu DOT edu> NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de X-Trace: nets3.rz.RWTH-Aachen.DE 981488723 16292 137.226.32.75 (6 Feb 2001 19:45:23 GMT) X-Complaints-To: abuse AT rwth-aachen DOT de NNTP-Posting-Date: 6 Feb 2001 19:45:23 GMT Originator: broeker@ To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Miguel A. Ballicora 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.