delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/12/26/16:50:48

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Date: Sun, 26 Dec 2004 16:49:42 -0500
Message-Id: <200412262149.iBQLngSn023598@envy.delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
To: djgpp AT delorie DOT com
In-reply-to: <6a7us0he1s9ml2djpp5tlm48lod92eei5c@4ax.com> (message from
Radical NetSurfer on Sun, 26 Dec 2004 15:34:07 -0500)
Subject: Re: DREADED fseek
References: <6a7us0he1s9ml2djpp5tlm48lod92eei5c AT 4ax DOT com>
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> He is using DJGPP 2.8.0, and I have 2.953, and

Those are GCC version numbers, not djgpp version numbers.  DJGPP
version numbers can be found in manifest/djdev*.ver or
include/sys/version.h

fseek() and fread() are funny under DJGPP, because they try to guess
what type of buffering scheme will work best for your program.  In
general, this system gives better *overall* performance, although it's
always possible to create test cases that show worse performance.

Each time you fread() in sequence, DJGPP increases the read-ahead
buffer size.  If you end up reading the whole file sequentially, this
results in a dramatic speedup.  If, however, you fseek(), the buffer
is reset to its smallest size.  This avoids reading in sectors that
may not be used, and optimizes small random access reads.

Also, fseek() may end up discarding the buffer.  If it does this when
it doesn't need to, that might be an opportunity for optimization.

Without seeing an actual complete test program, we can't say much
more.  For example, how big is Forward_Bytes?  How many bytes are you
reading at a time?  How much total data is being read?  Having a
working program to play with lets us investigate these kinds of
issues.

As for the arrays, we can't say much without a test program, because
there's too many variables.  Note that arrays require a certain amount
of math to index into each dimension, that could add up to more math
than just recomputing the values.

- Raw text -


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