Date: Fri, 12 Aug 1994 18:42:03 -0400 (EDT) From: Kimberley Burchett Subject: Re: Speed tuning programs To: Olly Betts Cc: djgpp AT sun DOT soe DOT clarkson DOT edu On Fri, 12 Aug 1994, Olly Betts wrote: > What I'd like are any tips or suggestions for tweaking the performance > of the DJGPP code to make it closer to the BCC code. Either compiler > options or coding suggestions. I made a batchfile called handcode.bat where you pass it the name of the program you want to hand code. Then it stops compiling at the assembler level and you can edit the assembler. I did it on one of my programs and cut out ten instructions from an inner inner loop and it goes about 46% faster now. Once you change the assembler source, you then run finish.bat and it compiles it to a program. I had to make two finishing batch files - finish.bat and release.bat. finish.bat makes it so it produces profiling output while release.bat strips the a.out and doesn't produce profiling info. I included a %2 in the batchfile so you could include profiling information if you want. You just type "handcode myprog -p" to get debugging info. If you include debugging info, you have to use finish.bat to finish compiling because release.bat doesn't include the right libs. I also had to take out some of the command line options from handcode.bat that got passed to cpp because the command line was too long. I took out some of the kindof repetetive defines that none of my programs use anyway. When you run the batch files, don't include the .c ending - it puts them there for you. What I like most is that most of the compile time is spent in cc1 so once you have assembler, tweaking the assembler takes _very_ little time. At least until you crash it at which point you have to run handcode again - I make a backup of the assembler output just in case. So here are the batch files if you want to use them. HANDCODE.BAT: cpp -lang-c -D__GNUC__=2 -D__GNUC_MINOR__=5 -Dunix -Di386 -DGO32 -DMSDOS -D__OPTIMIZE__ %1.c D:/cca00051 cc1 D:/cca00051 -fno-builtin -quiet -dumpbase %1.c -O4 -version %2 -o %1.s FINISH.BAT: as -o D:/ccc00051 %1.s ld c:\language\gcc/lib/gcrt0.o -Lc:\language\gcc/lib D:/ccc00051 -lm -lpc -lgcc -lc -lgcc coff2exe a.out RELEASE.BAT: as -o D:/ccc00051 %1.s ld c:\language\gcc/lib/crt0.o -Lc:\language\gcc/lib D:/ccc00051 -lm -lpc -lgcc -lc -lgcc strip -s a.out coff2exe a.out mv a.exe %1.exe Kim