Okay, i have changed the whole code that used the boost::regex library to a pure std approach, the code is the following:
Code:
ifstream file(filename);
char data[3000];
while (!file.eof())
{
file.getline(data, 3000);
string line(data);
stringToLower(line);
unsigned int position = 0;
while ((position = line.find_first_of(delimiters, position)) != -1)
{
int endPosition = line.find_first_not_of(delimiters, position);
string result = line.substr(position, endPosition - position);
position = endPosition;
dictionary[result]++;
}
}
return true;
This seems to be a much faster aproach than the boost::regex since it gives me total execution time of ~1.39s while the boost::regex was giving me ~4.01s.
Now i would like to squeeze this program to get the last drop of performance from it... Suggestions?
[edit]
Readability and good practices sugestion are welcome too
[/edit]