Original Post
I read a huge ascii file ( > 2MB ) using the >> operator for formated file reading. The file is simply a rectangular matrix of values, eg. 1000 x 1000 floats.
At the moment I do this:
std::vector<float> data;
data.resize( NUM_ELEMENTS );
std::ifstream is( FILENAME );
for ( int i = 0; i < NUM_ELEMENTS; ++i )
{
is >> data[i];
}
In the debug build this is incredible slow. In the release build it take about two seconds to load a file of about 3MB. Are there any ways to optimize the loading code?
BTW: Does a stream load the entire file into memory when opening it and do I load from the cached data?
Best regards
-Dirk