问题描述
与同事最近的对话在此问题上产生了不同的观点. SO成员,你怎么说?
我知道,甚至可伸缩性的概念也可以用许多不同的方式和上下文来理解,但这只是讨论时的一部分.对于可伸缩性的真正含义,每个人似乎都有不同的看法.我很好奇看到这里的变化也是如此.实际上,我针对该概念发布了一个问题.
我猜想最好的检查方法是编写基准,但我认为LINQ有可能进行优化,而手写类似的代码则没有.我不知道如何充分利用这些优势.LINQ使您可以表达自己想要的内容,而不是如何生成它.一个明显的优点是LINQ可自动并行化(请参见 PLINQ ).
LINQ的另一个优点是它很懒,因此您可以执行计算,并根据需要从集合中进行提取.您可以手工编写一个等效项,但是在LINQ中正确实现可能要容易得多.
Recent conversations with colleagues have produced varying points of view on this matter. What say you, SO members?
I know, even the concept of scalability can be taken in so many different ways and contexts, but that was part of the discussion when this came up. Everyone seemed to have a different take on what scalability really means. I'm curious to see the varying takes here as well. In fact, I posted a question just for that concept.
I would guess that the best way to check is by writing benchmarks, but in my opinion LINQ has the possibility for optimizations that hand-writing similar code does not. I don't know how well it takes advantage of those yet.
LINQ lets you express what you want, not how to generate it. One obvious advantage is that LINQ is automatically parallelizable (see PLINQ).
Another advantage to LINQ is that it is lazy, so you can perform calculations, drawing from the collection as needed. You could hand-code an equivalent, but it may be much easier to get right in LINQ.
这篇关于LINQ有多可扩展性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!