How C# Generics make your apps MUCH faster

preview_player
Показать описание
Here is how C# generics make your apps much faster
Рекомендации по теме
Комментарии
Автор

good old arraylists, it's like christmas, you never know what you gonna get

surgeon
Автор

For more context, the JIT will compile a new class/method with the type hard coded in, so a List<int> is literally just a List with a special name but the "_items" array is compiled as a int[] rather than object[], in other words, everywhere "T" is used gets replaced by the type provided at runtime.

ZintomV
Автор

Suprising thing is that to this day PowerShell still highly depends on non-generic dotnet types and a ton of boxing. It's completely working with object arrays, ArrayLists and HashTables. All things considered very legacy in C#.
As a scripting language it automates a LOT of stuff, that's the nice side of it. The JavaScript-style loosely typedness makes it very easy to write.
But yeah, when it comes to performance? Nope. Goodness!

jongeduard
Автор

It was nice to hear about the history of c# thanks.

kylekeenan
Автор

Nice. Probably the best improvement to c# along side hot reload.

Deltacasper
Автор

Yes, a List does not need to store references to the objects on the heap but the entire List must be allocated in the heap because it is growable. Nonetheless the items can be stored "next" to each other

whaisonw
Автор

Can you please compare between generics in C# and Java in terms of performance and internals

userc
Автор

Generics and interfaces. If you want a Var generic class, you can make an interface called IVar that is not generic that Var implements to use Vars of any type in your program.

cerulityk
Автор

if IRC the boxing and perpetual casting is Java's way of doing generic lists, whereas .NET recompiles the generic into it's own "specific" type implementation.
Not to shit on java... but.

jacopobingewatching
Автор

does the performance boost of generic collections only apply to primitives and structs, or also to your custom types?

Blaisem
Автор

You tried to get primitives together to justify a objects back in the days. Generics are really awesome, the only thing i miss is to use generic methods with annonymous types.always reflecting or work around it is the only drawback

johnathankrausrig
Автор

Sometimes better to use HashSets instead of Lists especially when huge amount of data is loaded

justchillout
Автор

Great video! I'd love to watch a more in depth video about generics

rushas
Автор

But why did they call it Generic List and not Specialized List which would be a more descriptive name? 🤔
Everyone knows what specialized means, thats not the case with generic

slashd
Автор

How long ago was this?
I remember it being a normal language back in MVC3

qmster
Автор

But reference types can be allocated on stack.

HistoireDuViolet
Автор

Does that mean that C#2 didn't make use of the stack? :O

david
Автор

I have to comment on the 69 and 420 he always uses as test data, please keep it up and don't address it.

magicspider
Автор

Too bad that they introduce run-time overhead! Compile-time generics would be a lot better!

nothingtoospecial
Автор

Thanks Microsoft for not ruin the best language.

vothaison
welcome to shbcf.ru