I was working in a project with CsvHelper in Visual Studio 2015. It worked fine. Then I switched to Visual Studio 2013 to do some test and CsvHelper worked very slow. When in VS 2015 takes 2 seconds at maximum to read a large file in VS2013 takes more than 5 minutes.
I test the same project opened in VS2013 and VS2015. In VS2013 runs slow, in VS2015 the opposite. The same project.
So, VS2013 must be doing something to cause the CsvHelper slow speed. Any ideas?
EDIT: To clarify, I run every test in debug mode.
I add my actual reading function:
internal void ReadInCSVPoint3DNew(string absolutePath)
{
CultureInfo Culture = new CultureInfo("en-US");
List<Point3D> result = new List<Point3D>();
string value;
using (TextReader fileReader = File.OpenText(absolutePath))
{
var csv = new CsvReader(fileReader);
csv.Configuration.HasHeaderRecord = false; // The head is not in good format, so, setting it true doesn't work.
csv.Read(); // Skip Head
while (csv.Read())
{
string[] Strings = new String[13];
for (int i = 0; csv.TryGetField<string>(i, out value); i++)
{
Strings[i] = value;
}
Point3D point = new Point3D()
{
PointX = (decimal)float.Parse(Strings[0], Culture),
PointY = (decimal)float.Parse(Strings[1], Culture),
PointZ = (decimal)float.Parse(Strings[2], Culture),
X = (decimal)float.Parse(Strings[3], Culture),
Y = (decimal)float.Parse(Strings[4], Culture),
Z = (decimal)float.Parse(Strings[5], Culture),
Intensity = (int)float.Parse(Strings[6], Culture),
LaserIndex = (int)float.Parse(Strings[7], Culture),
Azimuth = (int)float.Parse(Strings[8], Culture),
Distance = (decimal)float.Parse(Strings[9], Culture),
AdjustTime = (long)float.Parse(Strings[10], Culture),
TimeStamp = (long)float.Parse(Strings[11], Culture),
VerticalAngle = (int)float.Parse(Strings[12], Culture)
};
result.Add(point);
}
}
this.Data = result;
}