Lowering in C#: What's really going on in your code? - David Wengier

  Рет қаралды 33,061

NDC Conferences

NDC Conferences

Күн бұрын

Пікірлер: 41
@keja0
@keja0 4 жыл бұрын
This guy was awesome, good presentation, clear talking and interesting subject.
@sau002
@sau002 4 жыл бұрын
Good presentation. I like the simplistic approach.
@christofstanits
@christofstanits 4 жыл бұрын
excellent talk!
@MobilTemp
@MobilTemp 4 жыл бұрын
Great stuff
@alexeski4109
@alexeski4109 2 жыл бұрын
Amazingly insightful talk.
@lollo4711
@lollo4711 2 жыл бұрын
Enumerator: Removing items from the list (from inside the loop) will make MoveNext() return/set a false Current()-Item?!
@TheLbadwal
@TheLbadwal 3 жыл бұрын
Gold, many thanks!
@Iregger0
@Iregger0 3 жыл бұрын
Shouldn't that while loop @1:26 translate to something like again: if(something) dostuff i++ goto again; ? Now it (@1:31) looks more like do while Anyway, good stuff. Thanks.
@kevin179887
@kevin179887 4 жыл бұрын
Was the compiler mentioned that this talk referenced? There are many C# compilers and they operate differently.
@zombie_pigdragon
@zombie_pigdragon 2 жыл бұрын
At 36:00, he links to roslyn, which is the C# compiler that he used.
@DickBakerSql
@DickBakerSql 4 жыл бұрын
at offset 1:17 David blandly hops from foreach to for but this forgets that the foreach is IEnumerable and you DON'T know the count in advance, and there is no indexor so listOfInts[i] typically won't work (cf ICollection, etc) unless that sut is [say] an array. That jarred when I viewed this bit but I persisted to the end and he covers some good stuff later so hang in there!
@Kittoes0124
@Kittoes0124 4 жыл бұрын
I highly doubt that he "forgot." Is far more likely, based on his experience and the name of his variable, that he simply took the IList interface for granted here. Blindly performing the transformation on something that is only known to be of IEnumerable would indeed be silly but it is perfectly sane to rely on the ICollection contract that IList commits to.
@MulleDK19
@MulleDK19 4 жыл бұрын
Actually, depending on the type, the compiler will optimize a foreach loop to a for loop. Eg. in case of int[], it won't actually use an IEnumerator, and instead use pure IL instructions to iterate the array.
@DavidWengier
@DavidWengier 4 жыл бұрын
Those examples weren't supposed to be real, just trying to show the concept of lowering, but I appreciate the feedback and if I deliver the talk again I'll try to make that clearer.
@bbcskych4
@bbcskych4 4 жыл бұрын
Why there will be a stackoverflow exception in c#4's foreach ?
@merthsoft
@merthsoft 4 жыл бұрын
I believe he was referring to the website stackoverflow, because there were a LOT of questions about this behavior when C#4 came out.
@theMagos
@theMagos 4 жыл бұрын
18:28 (e as IDisposable)?.Dispose();
@keja0
@keja0 4 жыл бұрын
Not in the code he has shown, bc that was C# 4. Null-conditional operators are only after C# 6
@emmepombar3328
@emmepombar3328 Жыл бұрын
Ah, your code is before lowering. 😀
@payamism
@payamism 4 жыл бұрын
If you are concerned about performance to this low level, then C# is the wrong tool for the job. Go use C++, C, Rust...
@merthsoft
@merthsoft 4 жыл бұрын
Yes, this is all great stuff to know, but I don't think it's good to know for optimization reasons. If my manager told me that code chunk he showed at 33:35 was too slow or used too much memory I'd look at him concerned and then I'd profile it before doing any analysis about what the compiler is doing.
@mzg147
@mzg147 4 жыл бұрын
I am just concerned how my code really works.
@comradestinger
@comradestinger 4 жыл бұрын
I mean.. C# *is* used for some high-performance stuff, like in unity for games or other desktop workloads. Knowing which abstractions are cheap and which ones create their own classes and statemeachines (omg) I think is really good so you don't accidentally use them in hot paths.
@Robert-G
@Robert-G 4 жыл бұрын
Comrade Stinger the state machine isn’t the problem, that’s equivalent to an int state and a switch. The problem is, that it needs a class, and everything that allocates can trigger a „whole world stops GC sweep“
@ZahrDalsk
@ZahrDalsk 4 жыл бұрын
@@comradestinger C#? Well that explains why unity's performance is so famously bad.
@anantmishra6783
@anantmishra6783 4 жыл бұрын
dead boring but useful. D:
@rohithnaik123
@rohithnaik123 4 жыл бұрын
Very Confusing and unclear :(
@slavaknyazev45
@slavaknyazev45 4 жыл бұрын
which part?
@rohithnaik123
@rohithnaik123 4 жыл бұрын
@@slavaknyazev45 I feel like the speaker's ordering of topics was off. He should look into reformatting his talk to make it more intuitive and flowing. I had to watch this 3 times and then I got the entire thing.
@rohithnaik123
@rohithnaik123 4 жыл бұрын
I just want to add that the talk was very informative if you give it some time. The Sharplab demo was really cool as well. I think he should have used that in the beginning to make the intent of the video pop.
@UPSCCSE-ku7ej
@UPSCCSE-ku7ej 4 жыл бұрын
He is confused
Using Immutable Data Structures in C# and .NET - Spencer Schneidenbach
47:27
WILL IT BURST?
00:31
Natan por Aí
Рет қаралды 45 МЛН
МЕБЕЛЬ ВЫДАСТ СОТРУДНИКАМ ПОЛИЦИИ ТАБЕЛЬНУЮ МЕБЕЛЬ
00:20
Change your habits: Modern techniques for modern C# - Bill Wagner
55:46
NDC Conferences
Рет қаралды 251 М.
Writing async/await from scratch in C# with Stephen Toub
1:06:02
Unleash Your Functional Modeling Superpowers | C# Tutorial
14:24
Zoran Horvat
Рет қаралды 15 М.
Don't Use Polly in .NET Directly. Use this instead!
14:58
Nick Chapsas
Рет қаралды 60 М.
Brutally honest advice for new .NET Web Developers
7:19
Ed Andersen
Рет қаралды 179 М.
WHY IS THE STACK SO FAST?
13:46
Core Dumped
Рет қаралды 152 М.
Lowering in C# and the ability to predict code performance
12:04
Nick Chapsas
Рет қаралды 38 М.