|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
TableAdapter vs DataAdapter performanceThinking 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 Perhaps your results are wrong?
Table adapter is just a configured DataAdapter. -- Show quoteMiha Markic [MVP C#] RightHand .NET consulting & development www.rthand.com Blog: http://cs.rthand.com/blogs/blog_with_righthand/ <JRD> wrote in message news:ro6l22ps7960i8jern3ips4km8nmf9mfdf@4ax.com... > 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 > > > On Wed, 29 Mar 2006 22:02:32 +0200, "Miha Markic [MVP C#]" <miha at
rthand com> wrote: >Perhaps your results are wrong? May be, but I did repeat tests in another machines with similarresults. 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 ?<JRD> wrote in message news:56un22l924lspb3gohh4vjl3fmng4a32nq@4ax.com... I don't know. Measuring performance might be tricky. Perhaps you might try > On Wed, 29 Mar 2006 22:02:32 +0200, "Miha Markic [MVP C#]" <miha at > rthand com> wrote: > >>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. with a performance profiler. > It probably does - but it shouldn't be noticeable.>>Table adapter is just a configured DataAdapter. > > Yes, but may be TableMapping feature add some overload ? -- Miha Markic [MVP C#] RightHand .NET consulting & development www.rthand.com Blog: http://cs.rthand.com/blogs/blog_with_righthand/ |
|||||||||||||||||||||||