www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/02/11/20:25:38

From: "Miguel A. Ballicora" <ballicor AT pilot DOT msu DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Function and File ordering and speed optimization
Date: Sun, 11 Feb 2001 19:58:52 -0500
Organization: Michigan State University
Lines: 62
Message-ID: <3A87354C.98129CEF@pilot.msu.edu>
References: <3A8049B6 DOT 7C7B7BB1 AT msu DOT edu> <95pk8j$ft4$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <3A81AA1F DOT D8D883CB AT msu DOT edu>
NNTP-Posting-Host: pm650-20.dialip.mich.net
Mime-Version: 1.0
X-AUTHid: ballicor
X-Mailer: Mozilla 4.06 [en] (Win98; I)
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:
> 
> 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

I shuffled the order of the files in the input trying to put together
files
that have functions that call each other many times. I did this
manually, so
I believe it can be improved. After 10 minutes of trial and error I got
a increase of 10% in execution speed. Not spectacular, but totally free!
(10% here, 10% there... adds up!)

If djgpp had an option to sort the linking order of the functions I bet
that a further increase in speed could be seen.
I did not want to start moving funtions from on file to another...

I saw that grof has another feature that would help me better that
--function-ordering and it is ==> --file-ordering. However, I could not
get it to
work. I do not understand the relationship with "nm.exe" that is
mentioned
in the documentation. Did somebody use it before? 

Thanks,
Miguel

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019