Linq的性能比不是linq的查询好吗? [英] Linq performance is better than not linq Query?

查看:78
本文介绍了Linq的性能比不是linq的查询好吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在10000行之间进行搜索并更新其中的一些,哪种技术更适合我的搜索?linq还是其他??


请一个个回答我的问题吗?

1-Linq的性能好于没有10000行的linq查询吗?
2-3层的编程性能是否优于10000行中的1层?
3-LINQ to SQL和LINQ to实体有什么区别?


谢谢

i want to search between 10000 rows and update some of them ,which technology is better for my search?linq or the other??


Please answer my questions one by one ?

1-Linq performance is better than not linq Query in 10000 row?
2-3 layer programming performance is better than 1 layer in 10000 row?
3-what is difference between LINQ to SQL and LINQ to entity?


Thank you

推荐答案

虽然性能是可衡量的,但结果取决于数据和所使用的方法一样.

回答问题的唯一真实方法是让您使用您的数据测试每个建议的解决方案.那是唯一可以确定的方法.
Whilst performance is measurable the results are as dependant on the data as they are on the methodology used.

The only real way to answer your question is for you to test each of your proposed solutions with your data. That''s the only way to be sure.


1)不确定您的意思.使用LINQ搜索10,000个项目通常意味着您已经获取了这些行.也许直接在数据库上运行查询以获取过滤后的行会更快或更不占用大量内存.另一方面,如果您要使用LINQ to SQL与直接SQL,则可以使用特定的数据库进行测试.我认为您不会在那看到很大的不同.

2)这完全不会影响性能.这只是设计方法上的差异.多层体系结构用于更好的设计,可读性,结构化和可维护性.从理论上讲,您可以打破所有设计规则,并将所有内容放在一个源文件/一个类中,并且仍然具有出色的性能(不建议这样做).

3)看一下这些文章:

http://dotnetaddict.dotnetdevelopersjournal.com/adoef_vs_linqsql.htm [ http://msdn.microsoft.com/en-us/library/cc161164.aspx [ ^ ]

我都是通过Google搜索获得的(还有很多,但是这两个似乎是最简单的文章).
1) Not sure what you mean there. Using LINQ to search through 10,000 items would usually mean that you''ve already fetched those rows. Perhaps directly running a query on the database to fetch the filtered rows would be faster or less memory-heavy. On the other hand if you mean using LINQ to SQL vs direct SQL, that''s something for you to test out with your specific database. I don''t think you''d see much of a difference there.

2) This won''t affect performance at all. It''s just a design approach difference. multi-tier architectures are for better design, readability, structuring , and maintainability. Theoretically you could break all design rules and put everything in a single source file/one class and still have great performance (not that I''d recommend doing that).

3) Take a look at these articles:

http://dotnetaddict.dotnetdevelopersjournal.com/adoef_vs_linqsql.htm[^]

http://msdn.microsoft.com/en-us/library/cc161164.aspx[^]

I got both via Google searches (there were many more, but these two seemed the simplest articles).


LINQ to Object(实体)比LINQ to SQL更有效地进行大型搜索数字订票员!! :)
LINQ to Object (Entity) is more efficient than the LINQ to SQL to search in big number recors!! :)


这篇关于Linq的性能比不是linq的查询好吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆