TableAdapter vs DataAdapter performance

J

JRD

Hi,


Thinking of the best way to develop a data acces layer for a new
program I have been doing some performance test.


My lab pilot is as follows:

SqlServer 2000 + VS2005 TS in the same machine.
Storage procedure returning 100.000 records from a table



-----------------------------------------------
DataTable dt = new DataTable();
ArticulosTableAdapter ta = new ArticulosTableAdapter();
SqlDataAdapter da = new
System.Data.SqlClient.SqlDataAdapter(sqlCommand);.


Connected Model:
-----------------------------


puno = Environment.TickCount;
sqlCommand.Connection.Open();
SqlDataReader sqlDim = sqlCommand.ExecuteReader();
dt.L.oad(sqlDim);


sqlDim.Close();
sqlCommand.Connection.Close();


time = TimeSpan.FromMilliseconds(Environment.TickCount -
puno);
Trace.Write("Load From DataReader Time-> ");
Trace.WriteLine(time);


Running:
Load From DataReader Time-> 00:00:02.3440000


Disconnected Model:
------------------------------------


1) TypedDataSet with DataAdapter


puno = Environment.TickCount;
da.Fill(_articulosDS);
time = TimeSpan.FromMilliseconds(Environment.TickCount -
puno);
Trace.Write("Typed DataSet With DataAdapter Time-> ");
Trace.WriteLine(time);


Running:
Typed DataSet With DataAdapter Time-> 00:00:00.5620000


2) TypedDataSet with TableAdapter


puno = Environment.TickCount;
ta.Fill(_articulosDS.Articulos);
time = TimeSpan.FromMilliseconds(Environment.TickCount -
puno);
Trace.Write("Typed DataSet With TableAdapter Time-> ");
Trace.WriteLine(time);


Running:
Typed DataSet With TableAdapter Time-> 00:00:02.6250000


I understand that filling a DataTable with a DataReader is a time
consuming process that will take 2,34 secs for 100.000 records, but I
do not understand why Filling a TableAdapter I am getting poor
performance (3 times less) than Filling a DataAdapter.

Any Idea ?



Thank you
José Ramón
 
M

Miha Markic [MVP C#]

Perhaps your results are wrong?
Table adapter is just a configured DataAdapter.
 
J

JRD

Perhaps your results are wrong?

May be, but I did repeat tests in another machines with similar
results. If a limit SP records to 1000, both results like similar, but
they don't with 100.000 records.
Table adapter is just a configured DataAdapter.

Yes, but may be TableMapping feature add some overload ?
 
M

Miha Markic [MVP C#]

May be, but I did repeat tests in another machines with similar
results. If a limit SP records to 1000, both results like similar, but
they don't with 100.000 records.

I don't know. Measuring performance might be tricky. Perhaps you might try
with a performance profiler.
Yes, but may be TableMapping feature add some overload ?

It probably does - but it shouldn't be noticeable.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top