Iterator Benchmarks That Shocked With Unexpected Results

I wanted to create a follow-up post in my series on IEnumerables, iterators, and collections focusing on performance characteristics. When checking out the runtime performance and memory characteristics between these materialized collections and iterator benchmarks, I was very surprised! Check out this article for performance benchmark characteristics and some curious finds.

8 Comments

Yield! Reconsidering APIs with Collections

Yield: A Little Background The yield keyword in C# is pretty cool. Being used within an iterator, yield lets a function return an item as well as control of execution to the caller and upon next iteration resume where it left off. Neat, right? MSDN documentation lists these limitations surrounding the use of the yield keyword: Unsafe blocks are not allowed. Parameters to the method, operator, or accessor cannot be ref or out. A yield return statement cannot be located anywhere inside a try-catch block. It can be located in a try block if the try block is followed by a finally block. A yield break statement may be located in a try block or a catch block but not a finally block. So what does this have to do with API specifications? A whole lot really, especially if you're dealing…

0 Comments

End of content

No more pages to load