Performance

Coordinator
Oct 9, 2011 at 2:52 PM

Surprisingly proxies and lazy loading offer performance benefits for both the db set and the object set.  I might throw a database first version in the mix and see how it compares, but that's ususally a big hassel unless they've fixed the mojo they use to map pocos to the database - it tends to have a cow if you have two classes with the same name as a db entity.  in the big bucket o mvc stuff there are some tests comparing various orms and I didn't see a significant difference between any variant of ef that I tested - code first, precompiled views, vanilla ef, but I didn't do anything with proxies or lazy loading.  Linq To Sql was fater than EF which was faster than SubSonic.

 

So with lazy loading on I think it makes it more important to handle all of the entity to view mapping in the service layer.  If we have an alternate UI theoretically it would need the same functionality as the base UI and if not we could simply add new methods.

 

No Tuning 10x

First Last Min Max Avg Average Average w/o First/Last Average w/o Min/Max
Description=ObjectSet Proxies and Lazy Loading On 8 5 5 23 5.528 5 5.5
Description=DbSet Proxies and Lazy Loading 6 6 5 27 5.573 5 5.125
Description=DbSet Proxies and Lazy Loading Off 63 7 7 63 8.434 7 9.25
Description=ObjectSet Proxies and Lazy Loading Off 8 8 7 22 8.518 7 9.5
Description=DbSet Proxies On and Lazy Loading Off 8 8 7 20 8.281 7 8.875
Description=ObjectSet Proxies On and Lazy Loading Off 16 8 7 21 8.496 8 8

With index on OrderProducts.OrderId 10x

First Last Min Max Avg Average Average w/o First/Last Average w/o Min/Max
Description=ObjectSet Proxies and Lazy Loading On 5 4 3 88 4.137 3 3.625
Description=DbSet Proxies and Lazy Loading 6 4 3 9 3.78 3 3.75
Description=DbSet Proxies and Lazy Loading Off 65 8 6 65 6.649 6 6.375
Description=ObjectSet Proxies and Lazy Loading Off 6 6 6 14 6.734 6 6.5
Description=DbSet Proxies On and Lazy Loading Off 6 6 6 11 6.589 6 6.25
Description=ObjectSet Proxies On and Lazy Loading Off 7 6 6 13 6.62 6 6.75

With index on OrderProducts.OrderId 100x

First Last Min Max Avg Average Average w/o First/Last Average w/o Min/Max
Description=ObjectSet Proxies and Lazy Loading On 5 5 3 19 3.8003 3 3.8571
Description=DbSet Proxies and Lazy Loading 4 3 3 11 3.6457 3 3.5204
Description=DbSet Proxies and Lazy Loading Off 56 6 6 80 6.5403 6 6.5816
Description=ObjectSet Proxies and Lazy Loading Off 7 6 6 12 6.5206 6 6.5918
Description=DbSet Proxies On and Lazy Loading Off 7 6 6 22 6.4685 6 6.4489
Description=ObjectSet Proxies On and Lazy Loading Off 9 7 6 13 6.5558 6 6.4897
Coordinator
Oct 11, 2011 at 2:08 AM

Very nice.

I'm personally not interested in seeing DB First :o), but the proxies and lazy loading seem very sweet.