I'd start with "pread" which bypasses disk caching, and in much
bigger chunks than 64KB.
-----Original Message-----
From: perfoptimization-dev-bounces
+rbarris=email@hidden on behalf of Theodore H. Smith
Sent: Sat 2/10/2007 3:15 PM
To: email@hidden
Subject: Fast reading from files, using a pre-fetch approach?
Is it possible to write some kind of layer that will allow for fast
streaming from files, by using a pre-fetch approach?
That is, let's say I read in 64KB syncronously. Then before returning
I read 64KB non-syncronously.
I let the user process the first 64KB. And I hope by the time he's
processed the first 64KB, that the next chunk is already read in. If
it's not, I'll make the user wait till it is.
Subsequent reads will also be "pre-fetched".
Like this, I could theoretically double data throughput. Or at least
I'll be able to do reading "for free".
Anyone know how I'd go about doing such a thing, though? I was
looking at read and setvbuf, but none of the flags or modes look what
I need.
And more importantly, I need some kind of notication back when the
data's been read in!
Ideally, I wouldn't get a callback, but actually a variable written
into some location in my RAM. So here's my ideal API.
bool FastRead( int FileDes, char* Dest, int Bytes, int*
ResultInHereWhenReadHasCompleted );
ResultInHereWhenReadHasCompleted is just some location, that will
contain some flag after the read has completed.
I'd like to do something similar for writes too.
Is there some cross platform Unix way of doing this?
I'm aiming to optimise for OSX, but at the very least I want a normal
speed but reliable one for the other platforms.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
PerfOptimization-dev mailing list (PerfOptimization-
email@hidden)
Help/Unsubscribe/Update your Subscription:
40blizzard.com
This email sent to email@hidden