www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/19/03:33:10

Date: Wed, 19 Feb 1997 10:22:20 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: SerDevian <scriven AT CS DOT ColoState DOT edu>
cc: djgpp AT delorie DOT com
Subject: Re: Strange speed behaviour (fflush())
In-Reply-To: <330A13F6.41C6@CS.ColoState.edu>
Message-ID: <Pine.SUN.3.91.970219101815.22519L-100000@is>
MIME-Version: 1.0

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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019