NomenNescio
NomenNescio

Reputation: 3030

Is Linq to SQL faster than Linq to Entities?

I was having a discussion with a colleague of mine. We use Linq to Sql at work and I am kind of new at the job so I asked him why we are not using Linq to Entities? He made a few arguments and one of them was "Because Linq to Entities is slower than linq to Sql". I'm kinda skeptical about this, I do know that Linq to Entities is more complex and has additional features but I don't see why it is slower.

Is Linq to Entities slower? What would be a good response to such an argument?

Upvotes: 2

Views: 1044

Answers (2)

aleroot
aleroot

Reputation: 72636

In term of pure performance LINq To SQL should be slightly Faster because it uses a single layer of mapping while Linq to Entities have two layer of mappings and the additional mapping could have performance costs.

However you should do some benchmark in your own context of utilization because the performance differences could be neither noticed most of the times...

Upvotes: 1

Reed Copsey
Reed Copsey

Reputation: 564413

This is likely due to performance issues in early versions of the Entity Framework.

In earlier releases, there were quite a few issues with queries that would translate poorly in Entity Framework. The later releases addressed many of these issues, so now I would argue that it is likely as or better performance wise.

That being said, it really depends on what you're testing - benchmarks and profiling are the only way to tell. Linq To SQL will be faster for certain operations - but EF will also be faster on others. That being said, EF now allows many more opportunities to work around limitations and problems, so is likely more tunable over time.

Upvotes: 5

Related Questions