For those interested,
I have been spending a lot of time the last few days focusing on performance in my MVC app.
Here are some results:
4800 records, 12 columns each, with 2 joins from child table, each having 3 columns, thus 18 Columns in total, all orderder by ID Descending in parent table:
*EF6 AsNoTracking Enabled
EF6 Dynamic Object Creation: Avg. Execution Time - 83ms
Dapper Dynamic Object Creation: Avg. Execution Time- 152ms
EF6 Dynamic Object From View: Avg. Execution Time- 174ms
So, seems like EF6 is quite fast compared to version 5 & 4. But was quite suprised that EF6 beat Dapper.
Below the query code that won the race:
What are your experiences?
I have been spending a lot of time the last few days focusing on performance in my MVC app.
Here are some results:
4800 records, 12 columns each, with 2 joins from child table, each having 3 columns, thus 18 Columns in total, all orderder by ID Descending in parent table:
*EF6 AsNoTracking Enabled
EF6 Dynamic Object Creation: Avg. Execution Time - 83ms
Dapper Dynamic Object Creation: Avg. Execution Time- 152ms
EF6 Dynamic Object From View: Avg. Execution Time- 174ms
So, seems like EF6 is quite fast compared to version 5 & 4. But was quite suprised that EF6 beat Dapper.
Below the query code that won the race:
Code:
db.Configuration.AutoDetectChangesEnabled = false;
var x = db.tbl_Load.AsNoTracking()
.Select(a => new
{
a.ID,
a.Customer_ID,
a.Driver_ID,
a.EntryDate,
a.FTrailer_ID,
a.Horse_ID,
a.IsHazchem,
a.LoadCancelled,
a.LoadComplete,
a.LoadDeleted,
a.RTrailer_ID,
a.Status,
a.Transporter_ID,
LoadingSite = a.tbl_Load_LoadingSite.Select(b => new { LoadingID = b.ID, LoadingDate = b.LoadDate, LoadingSiteID = b.Loading_Site_ID }).OrderBy(c => c.LoadingDate).FirstOrDefault(),
OffloadingSite = a.tbl_Load_OffloadingSite.Select(b => new { OffloadingID = b.ID, OffloadingDate = b.OffloadDate, OffloadingSiteID = b.Offloading_Site_ID }).OrderByDescending(c => c.OffloadingDate).FirstOrDefault()
}
)
.OrderByDescending(a=> a.ID)
.ToList();
What are your experiences?