I have .txt files for data (100MB - 700MB). When reading these files and placing them into vectors, Linux does this 20-30x faster. Is this a system issue, or is there something I can do to speed up Windows?

I've ran the same code hundreds of times on each system. Both systems have a 64bit compiler (without it I get a badAlloc throw).

I've reduced the number of variables in the struct for simpler execution

   struct Data //Create all possible data that would be created or imported from data.
{
    double month, day, year, hour, min, seconds, open, high, low, close, volume;
};

  vector<Data> matrix;

  void createData (ifstream &dataFile, double tick, double tickA, string name) //Imports data into program.
{
    double month, day, year, hour, min, seconds, open, high, low, close, volume;
    char delim;

    if (dataFile.is_open())
    {
        while (dataFile >> month >> delim >> day >> delim >> year >> hour >> delim >> min >> delim >> seconds >> delim >> delim >> delim >> open >> delim >> high >>
               delim >> low >> delim >> close >> delim >> volume)
        {
            matrix.push_back({month, day, year, hour, min, seconds, open, high, low, close, volume});
        }
    }
}

1 Answers

4
mohammad RaoofNia On

As you can see here, ext filesystems are much faster in read/write operation than NTFS so it goes much faster on linux. so i think there is no way to make it much faster on Windows.