tags:

views:

57

answers:

1

How can I achieve the best file streaming performance in Vista? My goal is to read a large file (several hundred MB) over the network directly into memory.

I've allocated a memory block the same size as the file. This is also my destination buffer. I've tried ReadFile, _read, fread, ifstream::read, and boost::iostreams::mapped_file::const_data--specifying _O_SEQUENTIAL or FILE_FLAG_SEQUENTIAL_SCAN when appropriate. However, I haven't been able to match the throughput of a simple cut and paste file copy via Explorer. I routinely achieve only 50% of the performance of a file copy--profiled via Task Manager. What is Explorer doing differently, and how can I achieve the same level of performance?

A: 

How bigs are the chunks that you read each time? if they are too small or too big then your not utilizing the network to its full capacity.

Shay Erlichmen
There's only 1 chunk. For example, I tried 400 MB file with a 400 MB destination buffer. How could the chunk be too large? If you're concerned about swapping, I have more than enough available physical memory to fit several chunks.
Paul