Mail Archives: djgpp/2001/02/11/20:25:38
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 -