我写一个网格渲染经理认为这将是一个好主意,把所有使用相同着色器的网格,然后使这些将我在那着色器通。
I am writing a Mesh Rendering manager and thought it would be a good idea to group all of the meshes which use the same shader and then render these will I'm in that shader pass.
我目前使用foreach循环,但不知道是否利用LINQ的可能给我的性能提升?
I am currently using a foreach loop, but wondered if utilising Linq might give me a performance increase?
推荐答案为什么要LINQ是更快?它还使用循环内部。
Why should LINQ be faster? It also uses loops internally.
大部分的时间,LINQ会有点慢,因为它引入了开销。如果你在意性能,请不要使用LINQ。因为你想更好更短的可读性和可维护性code使用LINQ。
Most of the times, LINQ will be a bit slower because it introduces overhead. Do not use LINQ if you care much about performance. Use LINQ because you want shorter better readable and maintainable code.
更多推荐
LINQ声明不是“的foreach”循环更快
发布评论