std.file or stream

Daniel Keep daniel.keep.lists at gmail.com
Thu Nov 22 22:48:55 PST 2007



Kar wrote:
> Im trying to index a very large document collections. I need to know which file access method is faster, either std.file read all data into buffer or use stream.
> 
> i didnt understand stream very well, does it store file strings in memory or just a pointer to exact disc location.
> 
> The index file could be more than 10GBs, so which method is better.

Well, assuming the machine you're going to be running on doesn't
actually have 10 GB of memory, you probably don't want to read it all in
at once.

Streams work by reading in only what you actually use as you use it.  A
stream remembers "where" it is, so it doesn't need to read the whole
file into memory.

	-- Daniel



More information about the Digitalmars-d mailing list