This is running too slow. I convert a VB program to C#. The VB program takes 2 minutes and the C# takes 26 minutes. I privacy reasons I can
not send the WriteHistory. It build a StringBuilder and has a switch statement. There are 1.7 million records.
Any ideas on this would be appreciated.
arep
public static void PrintHistory(SqlDataReader sourceReader, bool b) { using (StreamWriter sw = new StreamWriter(@"Extract\History.txt", b, Encoding.Default)) { StringBuilder record = new StringBuilder(); while (sourceReader.Read()) { record = Program.WriteHistory(sourceReader); sw.WriteLine("{0}", record); } } }
Loading
VulpesPosted Sep 20, 2012, 6:10 PM
VulpesPosted Sep 21, 2012, 10:59 AM
Consequently, the time taken to create the objects and the frequent GCs were slowing down the application.
Anyway, pleased to hear that it seems to have solved the problem :)
A RepaskyPosted Sep 21, 2012, 10:15 AM
arep
A RepaskyPosted Sep 20, 2012, 5:12 PM
VulpesPosted Sep 18, 2012, 6:44 PM
However, I can see that the only thing that can possibly be executing slowly there is the Program.WriteHistory() method. So I'd concentrate your efforts on speeding that up.