I Hate IO

Ketil Malde ketil@ii.uib.no
16 Aug 2001 08:48:42 +0200


Alastair David Reid <reid@cs.utah.edu> writes:

> > My solution would be to have the API "random-access" based, and then
> > have a type that provided the current stream-based interface (which
> > I would use for your example):

> Operating systems, IO libraries, etc. like sequential access because
> they can play all sorts of tricks with reading ahead, buffering,
> etc. to overcome the latency of the physical disk and the overhead of
> performing a system call.  This makes a huge difference to
> performance.  It works because most access is sequential.

Perhaps one solution is to have normal file IO as it is, focusing on
sequential streams, along with sockets, pipes and what have you.

And provide an entirely different construct for random access.  

Much like in C where you'd use getc(), fgets(), getline(), and so on
for sequential access, but probably mmap() instead of fseek() if you
want random access.

Maybe.

-kzm
-- 
If I haven't seen further, it is by standing in the footprints of giants