G
Guest
I recently attempted to convert an application from .NET 1.1 to .NET 2.0. I
discovered that the performance of filling the DataTable objects was
ridiculously slower than in the .NET 1.1 incarnation. So I wrote a little
test app to run against both runtimes to see what the real performance
difference was:
class Program
{
const string SQLCommand =
"select LEXPR.LCID as LangLCID, LEXPR.RESID as RESID, LEXPR.EXPR as
Expression, LEXPR.UPDATE_TS as UpdateTS from LEXPR order by RESID, LCID";
const string connString =
"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\\Development\\LanguageStuff\\TCSLang.mdb;Persist Security
Info=True";
[STAThread]
static void Main(string[] args)
{
OleDbConnection connection = new OleDbConnection(connString);
connection.Open();
DataTable table = new DataTable();
OleDbDataAdapter adapter = new OleDbDataAdapter(SQLCommand, connection);
DateTime start = DateTime.Now;
adapter.Fill(table);
DateTime stop = DateTime.Now;
TimeSpan span = new TimeSpan(stop.Ticks - start.Ticks);
Console.WriteLine(span.ToString());
Console.WriteLine(table.Rows.Count);
Console.Read();
}
}
The output from the program when running against the 1.1 framework is:
2.0468619 seconds for 63,211 records.
The output from the program when running against the 2.0 framework is:
29.8591839 seconds for 63,211 records.
That means it takes 14.587786259541984732824427480916 times longer to load a
DataTable in the 2.0 framework (for this example). What's going on here?
discovered that the performance of filling the DataTable objects was
ridiculously slower than in the .NET 1.1 incarnation. So I wrote a little
test app to run against both runtimes to see what the real performance
difference was:
class Program
{
const string SQLCommand =
"select LEXPR.LCID as LangLCID, LEXPR.RESID as RESID, LEXPR.EXPR as
Expression, LEXPR.UPDATE_TS as UpdateTS from LEXPR order by RESID, LCID";
const string connString =
"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\\Development\\LanguageStuff\\TCSLang.mdb;Persist Security
Info=True";
[STAThread]
static void Main(string[] args)
{
OleDbConnection connection = new OleDbConnection(connString);
connection.Open();
DataTable table = new DataTable();
OleDbDataAdapter adapter = new OleDbDataAdapter(SQLCommand, connection);
DateTime start = DateTime.Now;
adapter.Fill(table);
DateTime stop = DateTime.Now;
TimeSpan span = new TimeSpan(stop.Ticks - start.Ticks);
Console.WriteLine(span.ToString());
Console.WriteLine(table.Rows.Count);
Console.Read();
}
}
The output from the program when running against the 1.1 framework is:
2.0468619 seconds for 63,211 records.
The output from the program when running against the 2.0 framework is:
29.8591839 seconds for 63,211 records.
That means it takes 14.587786259541984732824427480916 times longer to load a
DataTable in the 2.0 framework (for this example). What's going on here?