Become a patron and get access to source code and exclusive live streams: [ Ссылка ]
LINQ is too slow to be of use when modifying lists/arrays, and for loop is not applicable to both, nor is it the fastest either. Watch this demo and learn how to modify contents of an array and a list uniformly, and still with running time that is way below other methods.
In this demo, we will measure performance of iterating through an array and through a list, using common for loop, a LINQ expression, and a span. The rest of the demo is dedicated to measuring performance of operations that mutate content of an array or a list.
Each experiment is followed by a benchmark and explanation of the results gathered by running the benchmark. Eventually, spans will be a clean winner in all respects: execution speed, minimum memory footprint, random access to memory locations, universal support for arrays and lists.
And there will be more! You will learn the dangers that hide behind using a span created from a list, and how to avoid making a bug.
Chapters:
00:00 Intro
00:46 Improving iteration performance
04:02 Improving performance of modifying a list
06:14 Using a span for fast list modification
09:27 Analysis and comment on performance data
Learn more from video courses:
Beginning Object-oriented Programming with C# ► [ Ссылка ]
Collections and Generics in C# ► [ Ссылка ]
Making Your C# Code More Object-oriented ► [ Ссылка ]
Other courses at Pluralsight ► [ Ссылка ]
Other courses at Udemy ► [ Ссылка ]
Other videos on this channel you may be interested in watching:
Using GitHub Copilot to Write Complex Code | Step-by-step Tutorial ► [ Ссылка ]
Coding with GitHub Copilot - Beginner to Master | VS Code Demo ► [ Ссылка ]
What is Covariance and Contravariance in C# ► [ Ссылка ]
How to Initialize a Clean ASP.NET Core Project with Entity Framework Core and Identity ► [ Ссылка ]
The Null Conundrum: A Guide to Optional Objects in C# ► [ Ссылка ]
Ещё видео!