Array Performance Optimizations
In this module we'll examine performance optimizations for different kinds of arrays in C#.
Lesson Preview
We introduce the three array varieties available in .NET: one-dimensional, multi-dimensional, and jagged arrays, using an image manipulation scenario to motivate the comparison. The lesson explains the syntax differences and the jagged-array initialization loop, setting up an investigation of which approach is fastest for pixel access.
Lessons
- 1D, 2D and Jagged Arrays Preview 8 min
- 1D Arrays in Intermediate Language 6 min
- 2D Arrays in Intermediate Language 3 min
- Jagged Arrays in Intermediate Language 5 min
- Demo: Benchmarking Arrays (part 1) 10 min
- Demo: Benchmarking Arrays (part 2) 6 min
- Array Performance Recap 3 min
- For versus Foreach Performance 11 min
- Foreach on an Array 7 min
- Demo: Benchmarking For and Foreach 4 min
- Demo: For and Foreach in Intermediate Language 5 min
- For outperforms Foreach 2 min