[comp.sys.mac.programmer] THINK C build speed-up answer

lim@iris.ucdavis.edu (Lloyd Lim) (11/06/89)

To repeat the subject I originally posted, I found that in my computation-
intensive application speeds up about %13 when I build it instead of running
it from the project.  Some of you suggested some possible answers and I set
out to determine exactly what made the project slower.

The computational part uses mostly 16 and 32-bit integer math with some Fixed
and Fract math and some floating point via SANE.  The watch is animated.
Every second or so WaitNextEvent is called to look for a command-period,
DrawString is used to update some status info, and a fprintf to the console
saves some debugging info in a file.

So who gave the right answer?  It wasn't the ANSI library.  It wasn't the extra
resource file open (I guess this could slow you down but like I said I'm
basically doing math).  It isn't the smart linker cutting out code.  It isn't
the code generator optimizing short branches.  I tried out these possibilities
where possible.  The first correct answer I saw was suggested by Tom Lippincott
who suggested it was the debugger.  You're right!  Running without the THINK
Debugger speeds up the project by %13 and gives the exact same running time as
the built application.

I noticed a comment in another unrelated post that said TMON slows things
down.  I was curious and turned TMON off and ran the built application again.
The total speed-up went up to %34.  Your numbers will vary depending on what
you are doing and how you calculate your percentages.

Thanks for your suggestions.
+++
Lloyd Lim     Internet: lim@iris.ucdavis.edu (128.120.57.20)
              Compuserve: 72647,660
              US Mail: 146 Lysle Leach Hall, U.C. Davis, Davis, CA 95616