From: "Miguel A. Ballicora" Newsgroups: comp.os.msdos.djgpp Subject: Re: Function and File ordering and speed optimization Date: Wed, 07 Feb 2001 15:03:43 -0500 Organization: Michigan State University Lines: 44 Message-ID: <3A81AA1F.D8D883CB@msu.edu> References: <3A8049B6 DOT 7C7B7BB1 AT msu DOT edu> <95pk8j$ft4$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> NNTP-Posting-Host: padmanab-51.user.msu.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.7 [en] (WinNT; I) X-Accept-Language: en,pdf To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hans-Bernhard Broeker wrote: [snip] > > > 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. Thanks for the answer and the discussion! very instructive to me. And that is what I needed to know!. I do not know if this kind of optimization is going to be useful in my case. Probably not much, but I got curious when I changed in RHIDE the name of one of files in the project and I got ~5% reduction in the the speed. I renamed the file to the original and I recovered the speed. Apparently, RHIDE gives to the compiler and linker the list of files sorted alphabetically, so renaming files change the function order. I did not play around much with this, but it looked weird. That is why I thought that I could optimize the order of the files and functions. When I have time I will try a little bit of this. I won't try to sort the whole thing but I will chose the smallest and hottest functions the profiler will give me. I won't be a lot of work, I think. Of course, I have to do other obvious optimizations first, but since speed is critical to me, I won't discard anything... Thanks, Miguel