Slow execution on Windows compared MacOS

Hi,

I am a bit new with developing on Windows and I am struggling with a code that take ages to run. However, the code runs just fine on my Mac.
The part of code which is really slow is meant to load data from a file:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
typedef boost::gregorian::date bdate;

std::ifstream in;
std::string line;
std::vector<std::string> lines;
  
// Try opening the file
in.open(filename, std::ifstream::in);

std::vector<std::string> outerArray; // All blocks separated by ,
    
while (!IO::safeGetline(in, line).eof())
   lines.push_back(line);
    
// Container tools
std::vector<std::string> header;

// Getting the asset names, number of assets, start date and end date
boost::split(header, lines.front(), boost::is_any_of(","));
const unsigned int nbassets = (int)(header.size() + 1) / 3;
std::vector<std::vector<double> > quotes(nbassets, std::vector<double>(0));
std::vector<std::vector<bdate> > dates(nbassets, std::vector<bdate>(0));
    
bdate date;
std::string assetname;
// Collecting the dates and prices
for (unsigned int i = 1; i < lines.size(); i++)
{
   // Clear the containers
   outerArray.clear();
   boost::split(outerArray, lines[i], boost::is_any_of(","));
      
   // Add the historical price of each asset if it trades
   for (unsigned int j = 0; j < nbassets; j++) {
      if (outerArray[3 * j] != "") {
         // Get the date and trading date of the line
         date = TDate::Text2BDate(outerArray[3 * j]);
         dates[j].push_back(date);
         quotes[j].push_back(atof(outerArray[3 * j + 1].c_str())); // (j+1) because of the date in column 0
      }
    }
 } 

bdate TDate::Text2BDate(std::string text) {
  // Container and separate all three parts of date (separated by /)
  std::vector<std::string> innerArrayDiv;
  boost::split(innerArrayDiv, text, boost::is_any_of("/"));
  
  int day = std::atoi(innerArrayDiv[0].c_str());
  int month = std::atoi(innerArrayDiv[1].c_str());
  int year = std::atoi(innerArrayDiv[2].c_str());
  
  return bdate(year, month, day);
}


The file has 1100 columns and 4300 rows and I'm using the latest version of Visual Studio Enterprise. This section of code uses several functions from the boost library. Could it be because of the .dll? To be honest I don't really know where to look because it works perfectly fine with Xcode. Or is it that vector of vector runs very slowly with Microsoft compilator compared to MacOS?

Thanks for your help
Jonathan
Last edited on
Make sure you compile and run the program in "Release mode".
Indeed I was using "Debug mode".
I switched to "Release mode", updated the Properties for libraries "Additional Include Directories (C/C++>General) and "Additional Library Directories" from the "Debug mode", but it won't compile.

Error	LNK2001	unresolved external symbol __imp__invalid_parameter	Quantstrat	C:\Dev\Quantitative Strategies\trunk\Quantstrat\Quantstrat\Asset.obj	1	
Error	LNK2001	unresolved external symbol __imp__invalid_parameter	Quantstrat	C:\Dev\Quantitative Strategies\trunk\Quantstrat\Quantstrat\libboost_date_time-vc140-mt-gd-1_61.lib(greg_month.obj)	1	
Error	LNK2001	unresolved external symbol __imp__CrtDbgReportW	Quantstrat	C:\Dev\Quantitative Strategies\trunk\Quantstrat\Quantstrat\Asset.obj	1	
Error	LNK2001	unresolved external symbol __imp__CrtDbgReportW	Quantstrat	C:\Dev\Quantitative Strategies\trunk\Quantstrat\Quantstrat\libboost_date_time-vc140-mt-gd-1_61.lib(greg_month.obj)	1	
Error	LNK2001	unresolved external symbol __imp__free_dbg	Quantstrat	C:\Dev\Quantitative Strategies\trunk\Quantstrat\Quantstrat\msvcprtd.lib(locale0_implib.obj)	1	
Error	LNK2001	unresolved external symbol __imp__malloc_dbg	Quantstrat	C:\Dev\Quantitative Strategies\trunk\Quantstrat\Quantstrat\msvcprtd.lib(locale0_implib.obj)	1	


I've looked at several posts on those types of error but could solve it. I've checked that non-de debug libraries for boost are there and linked to via "Additional Library Directories". Also, I don't get why it is looking for libboost_date_time-vc140-mt-gd-1_61.lib, since gd stands for the debug version.

Thanks for your help,
Jonathan
Last edited on
Topic archived. No new replies allowed.