C# IEnumerable: Loop me harder - [5 Rider licenses to give away]
Video Statistics and Information
Channel: Tarodev
Views: 5,959
Rating: undefined out of 5
Keywords: c#, enumerable, ienumerable, ienumerator, enumerator, c# enumerable, implementing ienumerable and ienumerator, ienumerable in c#, c# tutorial, c# programming, c# basics, how to use ienumerable, c# foreach, c# loops, c# (programming language), c# programming language for beginners
Id: 2sqyd-qtHYg
Channel Id: undefined
Length: 25min 14sec (1514 seconds)
Published: Sun Nov 28 2021
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.
First of all, let me say that your tutorial quality is excellent. Structure, pacing and production values are very well done! I'm not the target audience so I can't judge fairly on the content itself, but it seemed to me to strike the sweet spot in amount of detail vs. complexity for beginners/intermediate coders.
But I feel you should include a warning to your viewers that IEnumerables are one of the most common causes of code-based performance issues. Not a problem for hobby programmers, but projects subject to commercial constraints (consistent FPS, or mobile support) will hit a wall if they are not used very carefully.
Nearly any IEnumerable/IEnumerator/LINQ call will generate garbage and waste CPU cycles. Which puts these constructs in an awkward position for Unity coding: most programmers will understand the concepts needed for usage (interfaces, and generics) earlier than the concepts needed to understand the consequences (GC strategy, boxing, duck-typing and engine critical loops).
As a result, I mostly tend to simply tell people learning Unity coding "never use Enumerables/LINQ except 'foreach on List<>'". Whenever anyone reaches the point where they see why that statement is bollocks, it means they also know enough to use them without tanking their performances.
In case you haven't chanced upon them, Jackston Dunstan did a great serie of posts on the subject:
Enumerables Without the Garbage: Part 1
Do Foreach Loops Still Create Garbage?
Loops in IL2CPP
Basic LINQ Performance
and especially Just How Much Garbage Does LINQ Create?
Sorry to be sounding a bit negative here - I hope your channel continues to grow, your videos fill a much-needed void between the innumerable "what is a variable" tutorials and the "here's how to use architecture-specific behaviour to shave 0.03ms on GPU-based fluid rendering" talks :) Maybe just include a caveat on this particular subject?