Date: Fri, 20 Dec 96 12:38:04 CST From: "Jordy Potman" Message-Id: <58079.s9404198@student.utwente.nl> Reply-To: To: eliz AT is DOT elta DOT co DOT il, djgpp AT delorie DOT com Subject: Re: program with profiling info runs slower with DJGPP 2.01 On Mon, 16 Dec 1996 17:24:06 +0200 (IST), Eli Zaretskii wrote: > >On Wed, 11 Dec 1996, Jordy Potman wrote: > >> I have just upgraded from DJGPP 2.00 to DJGPP 2.01. My program >> ( a 3D graphics program) runs just fine build with DJGPP 2.00, >> but if I rebuild it with the same makefile using DJGGP 2.01 it >> runs about 30 times slower (The frame rate drops from 30 to 1 frame >> per second). This happens only when the -pg option is turned on. Without >> this option the program runs fine with DJGPP 2.01. > >How much memory does your program need and how much free DPMI memory do >you have on your machine? (v2.01 might need more memory than v2.0, and >since profiling code is in locked memory, your program might start paging >when compiled with -pg.) > >If the above doesn't solve the mystery, please tell more about what your >program does, and try to reproduce this problem with the smalles program >that you can come up with (which can be posted here). > It's hard to tell exactly how much memory my program needs, but it won't be more than 1 MB. The amount of free DPMI memory go32-v2 reports varies (I'm running in a Win95 dos box on a 16 MB machine, with all memory settings at auto), but it is at least 4 MB. The hard disk light doesn't flash when I'm running my program, so I don't think there is any paging. The program I'm having this problem with is Michael Abrash's ZSORT example. I ported it to DJGPP (wasn't much work) and try to add in some new features just to learn a little 3D programming. I've tried to reproduce the problem in a smaller program but haven't succeeded yet. Small programs with only one simple function that is called repeatedly (my program calls the main rendering function repeatedly) don't show the problem. I think the problem is caused by repeatedly calling a lot of functions (in my main rendering function there are a lot of calls to other functions). This is not very easy to reproduce in a smaller program. I have profiled my program compiled with v2.0 and v2.01. There are some differences in the output of gprof. Profile compiled with DJGPP v2.00: Each sample counts as 0.055556 seconds. % cumulative self self total time seconds seconds calls ms/call ms/call name 71.05 1.50 1.50 151 9.93 9.93 BitBlt 10.53 1.72 0.22 151 1.47 1.47 ScanEdges 5.26 1.83 0.11 94475 0.00 0.00 DotProduct 5.26 1.94 0.11 151 0.74 13.24 UpdateWorld 5.26 2.06 0.11 _int86 2.63 2.11 0.06 13139 0.00 0.01 ClipToPlane 0.00 2.11 0.00 1 0.00 1999.82 main Profile compiled with DJGPP v2.01: Each sample counts as 0.055556 seconds. % cumulative self self total time seconds seconds calls ms/call ms/call name 33.33 0.11 0.11 18 6.17 6.17 BitBlt 33.33 0.22 0.11 _int86 16.67 0.28 0.06 883 0.06 0.06 ClipToFrustum 16.67 0.33 0.06 18 3.09 3.09 ScanEdges 0.00 0.33 0.00 11394 0.00 0.00 DotProduct 0.00 0.33 0.00 1592 0.00 0.00 ClipToPlane 0.00 0.33 0.00 18 0.00 12.34 UpdateWorld 0.00 0.33 0.00 1 0.00 222.20 main (I have deleted the functions that hardly take any time.) I can't explain why _int86 takes such a large % of time in v2.01. The profile also shows that the program is a lot slower in v2.01, take a look at the number of calls to UpdateWorld (the main rendering function). I hope this helps a little and I will try to find a smaller program that shows the same problem. Jordy Potman PS I won't be able to read my mail for about 2 weeks (Christmas holiday) so it may take some time before you get a response.