From: dontmailme AT iname DOT com (Steamer) Newsgroups: comp.os.msdos.djgpp Subject: Re: Function and File ordering and speed optimization Date: Tue, 06 Feb 2001 20:44:24 GMT Organization: always disorganized Lines: 24 Message-ID: <3a806223.36016915@news.freeserve.net> References: <3A8049B6 DOT 7C7B7BB1 AT msu DOT edu> NNTP-Posting-Host: modem-83.swallow.dialup.pol.co.uk X-Trace: news5.svr.pol.co.uk 981492266 13574 62.137.236.83 (6 Feb 2001 20:44:26 GMT) NNTP-Posting-Date: 6 Feb 2001 20:44:26 GMT X-Complaints-To: abuse AT theplanet DOT net X-Newsreader: Forte Free Agent 1.11/32.235 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: > 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? Do I have to place the function > definitions in the same order in one file.c when I compile? Is djgpp > going to follow that sorting? Do I have to turn on or off any > optimization flag? The profiler doesn't tell you how to order the functions. It tells you how often each function was called, and roughly how much of the running time was due to each function, as well as some other information. In order to speed up your program, you need to look at the functions that the profiler says are taking up most of the time, and think about how to make them run faster (or even how to avoid using them at altogether). This is the point of a profiler: it tells you where you should concentrate your optimization efforts, so that you don't spend ages optimizing things that don't matter. You can also try inlining the functions that are called most often. This may well slow things down, but it's worth a try.