table.Fill(data.ToArray()) takes a very long time to populate a table

Dec 21, 2011 at 6:23 PM

I have roughly 1000 rows ( at times maybe more ) and the Fill method of table takes a very very very long time to populate.

Any optimization tricks someone knows about or should this really be a DataTable; which I haven't tried yet.

 

~jecoute

Jan 14, 2012 at 4:15 PM

What magnitude are you talking about?

Just performed a quick test. Added 1k rows to an existing ASP.NET project. Request completed in less than 6 seconds with 10 column output. Output size roughly 100Kb. Data source ADO.NET Entity Framework.

My suggestion. First check out how long does it take to prepare data before you even call Fill method. With different ORMs it is a common mistake when additional database requests are made for every single record.

Second template file can contain formatting with unpredictable impact on performance. Create from scratch simplest template possible just to check if formatting is causing delay.