Date: Wed, 19 Feb 1997 10:22:20 +0200 (IST) From: Eli Zaretskii To: SerDevian cc: djgpp AT delorie DOT com Subject: Re: Strange speed behaviour (fflush()) In-Reply-To: <330A13F6.41C6@CS.ColoState.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Tue, 18 Feb 1997, SerDevian wrote: > The thing that confuses me is that if I add a "fflush(stdout)" before > the main graphical loop, the program speeds up by about 10 fps (80 -> 90 > fps). I figured at first that maybe having something hanging in the > buffer caused something to be lurking in the background, slowing things > down; but that explanation doesn't make sense within this particular > program because I flush stdout before the main loop anyway. A more plausible explanation might be that the changes in the code cause your program to overflow the CPU cache, especially since you use -O3 which causes gcc to inline everything in sight. Try disabling the caches (both the L1 on the chip and the L2 on the motherboard) and see if that makes both versions run at the same (much slower) speed. > Maybe fflush() modifies the timer? No, `fflush' doesn't do anything to the timer.