[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sequential vs. Random access

From: John Darrington
Subject: Sequential vs. Random access
Date: Thu, 1 Feb 2007 08:37:56 +0900
User-agent: Mutt/1.5.9i

On Wed, Jan 31, 2007 at 07:10:13AM -0800, Ben Pfaff wrote:
     John Darrington <address@hidden> writes:
     > On Tue, Jan 30, 2007 at 10:30:43PM -0800, Ben Pfaff wrote:
     >      So I'm not proposing to
     >      encourage use of random access where it's not necessary.
     > Would it therefore be worth having a flag passed to the casereader
     > constructor which declares whether or not the casereader performs
     > random access? 
     What's the intended usage?

Well I suppose it's similar to declaring a variable  const.  If we
have something similar to 

 struct casereader *sequential_reader = create_casereader (SEQUENTIAL);
 struct casereader *random_reader = create_casereader (RANDOM);

and the implementation enforces sequential-only access unless random
is requested, then there may be two possible advantages:

1.  By declaring a reader sequential, we can trap inadvertent random
    access.  In code reviews, any use of random readers is obvious,
    and the reviewer may be able to suggest a faster method using
    sequential access. 

2.  Maybe the implementation can make internal optimisations if it's been
    passed the SEQUENTIAL flag?

Of course I don't know if this really fits in with your code.  It's
just a suggestion.


PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See or any PGP keyserver for public key.

Attachment: signature.asc
Description: Digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]