A Complete .NET Developer's Guide to Span with Stephen Toub

SdĂ­let
VloĆŸit
  • čas pƙidĂĄn 6. 06. 2024
  • Scott and Stephen are back with another entry in the Deep .NET series, this time looking deep at System.Span enabling the representation of contiguous regions of arbitrary memory, regardless of whether that memory is associated with a managed object, is provided by native code via interop, or is on the stack. And it does so while still providing safe access with performance characteristics like that of arrays. Let's go deep on Span.
    Chapters:
    00:00:00 Exploring the Impact and Evolution of Span in Software Engineering
    00:03:09 Deep Dive into Assembly Code and its Translation
    00:04:15 Exploring Methods to Disassemble and Analyze C# Function
    00:05:43 Exploring the JIT Compiler and Assembly Code Optimization
    00:12:03 Understanding Arrays and Pointers in Programming
    00:16:46 Understanding Memory Management and Array Access in Programming
    00:24:35 Discussing the Cost and Implementation of Memory Management Functions
    00:26:23 Exploring the Intersection of Performance, Maintenance, and Interop in Programming
    00:31:51 Understanding the Concept and Impact of Span in Computer Science
    00:39:28 Discussion on Memory Protection and Immutability in Unix and Windows
    00:45:59 Implementing and Understanding the Concept of Ref Functions in C#
    00:51:08 Exploring JavaScript Optimal Notation and Memory Management
    00:54:28 Exploring the Implementation and Functionality of Span in Programming
    00:59:53 The Evolution and Impact of Span in .NET Development
    Resources:
    Documentation: learn.microsoft.com/dotnet/st...
    Connect with .NET:
    Blog: aka.ms/dotnet/blog
    Twitter: aka.ms/dotnet/twitter
    TikTok: aka.ms/dotnet/tiktok
    Mastodon: aka.ms/dotnet/mastodon
    LinkedIn: aka.ms/dotnet/linkedin
    Facebook: aka.ms/dotnet/facebook
    Docs: learn.microsoft.com/dotnet
    Forums: aka.ms/dotnet/forums
    đŸ™‹â€â™€ïžQ&A: aka.ms/dotnet-qa
    👹‍🎓Microsoft Learn: aka.ms/learndotnet
    #dotnet
  • Věda a technologie

Komentáƙe • 140

  • @BloodHaZaRd666
    @BloodHaZaRd666 Pƙed 25 dny +77

    Like video at 0 seconds just because of @Stephen Toub

    • @akeemaweda1716
      @akeemaweda1716 Pƙed 25 dny +4

      Not you alone. I did exact same thing, because it's the wizards show!

    • @asedtf
      @asedtf Pƙed 25 dny +4

      Like this comment at 1 second because I had to stop to like the video first because of Stephen Toub

    • @thomastaylor648
      @thomastaylor648 Pƙed 24 dny +3

      We need more Stephen Toub's

  • @barrysphone
    @barrysphone Pƙed 16 dny +21

    This series is awesome, please keep it going for a long time. Stephen's knowledge is incredible and his enthusiasm is infectious. The dynamic between Scott and Stephen make this series unmissable.

  • @marklord7614
    @marklord7614 Pƙed 25 dny +98

    Man, these guys are killing it with the series -- great topics.

  • @The.WorldVentures
    @The.WorldVentures Pƙed 25 dny +53

    How does someone even become as great as Stephen Toub, man the guy knows his stuff.

    • @jackkendall6420
      @jackkendall6420 Pƙed 24 dny +10

      You do it as your fulltime job for multiple decades, haha.

    • @kaolyfe-cw2cm
      @kaolyfe-cw2cm Pƙed 23 dny

      Pray enough to the coding gods...j/k 😄

  • @lordtony8276
    @lordtony8276 Pƙed 12 dny +8

    "Have you got anything without Span?"
    "Well, there's Span Span List and Span, that's not got much Span in it."

    • @p.j.wilkins1321
      @p.j.wilkins1321 Pƙed 4 dny

      Lobster Thermidor aux crevettes with a Mornay sauce, garnished with truffle pùté, brandy, and a fried egg on top, and Span.

  • @1camper69
    @1camper69 Pƙed 23 dny +24

    These talks from Stephen are truly the best dotnet content available. Stephen has the knowledge and goes next level in explaining it extremely clear but simple and is just a joy to listen to.

  • @Tamazakis
    @Tamazakis Pƙed 25 dny +26

    TimeSpan well spent! Thank you :)

  • @MatteoGariglio
    @MatteoGariglio Pƙed 25 dny +33

    This series of videos featuring Stephen Toub is truly remarkable and incredibly interesting. Thank you!

  • @CuriouslyContent
    @CuriouslyContent Pƙed 25 dny +21

    I can't get enough of this content :) Who would have thought that an hour long video on spans is literally the most exciting thing on my feed this week!

  • @TheChonsey
    @TheChonsey Pƙed 24 dny +9

    Awesome content. Please make a video on System.IO.Pipelines

  • @FICHEKK
    @FICHEKK Pƙed 25 dny +14

    Learning from Stephen Toub is such a pleasure, man is a .NET master!

  • @ElSnakeObwb
    @ElSnakeObwb Pƙed 25 dny +28

    Love this series. keep it up

  • @weirdwyrd2017
    @weirdwyrd2017 Pƙed 18 dny +2

    That floppy drive jumper comparison got me. The assembly I could follow, ain't never heard of a jumper before. Today I learned a couple things! Great content!

  • @BryanKelly
    @BryanKelly Pƙed 18 dny +6

    How does Span relate to Memory? I'd love to see a follow up to this that gets into that detail.

    • @user-dc9zo7ek5j
      @user-dc9zo7ek5j Pƙed 6 hodinami

      Memory is on the heap, Span is stack only. You can use Memory just like any other non-ref type, but Span can be used only within the function. Also, Memory can be used in async await, while the other cannot (because of stack only constraint). Memory behaves like Span, but it is much closer to ArraySegment without being array only type. I don't think I have used this type anywhere, but I have seen it being used around the Stream class.

  • @fieryscorpion
    @fieryscorpion Pƙed 24 dny +4

    This is amazing!
    Now I need a video on Multithreading and Parallel Processing from Scott and Stephen!

  • @behboodik
    @behboodik Pƙed 25 dny +6

    Every video with Stephen in it is a treasure

  • @onodera3964
    @onodera3964 Pƙed 2 dny

    Great series, loving it. Some of the topics I would love to see covered next:
    - how equality works (intermediate)
    - how the allocator and and the GC work (expert)
    - how exceptions work (expert)
    - how analyzers work
    - how generators work
    - how JIT works

  • @lejoyke
    @lejoyke Pƙed 4 dny

    Although I don't understand some things, I still feel excited. Please continue to keep up

  • @sanampakuwal
    @sanampakuwal Pƙed 25 dny +9

    WOW!!! Love these series, please don't stop!

  • @lstutzman
    @lstutzman Pƙed 25 dny +8

    Fantastic content guys!! Can’t wait for the next one. A deep dive into the GC would be cool

  • @Matt-tp9lh
    @Matt-tp9lh Pƙed 5 dny

    Awesome series! Please do a video on the async runtime of c# next about how the default task scheduler works, especially interested in knowing how tasks get scheduled and as developers using the async runtime how do we avoid common pitfalls of inefficient patterns

  • @superpcstation
    @superpcstation Pƙed 24 dny +4

    Please don't stop making these!

  • @amrswalha
    @amrswalha Pƙed 24 dny +4

    Scott and Stephen are doing a great job, all the best.

  • @dlandi
    @dlandi Pƙed 23 dny +3

    Scott and Stephen: Outstanding series!

  • @MarkRendle
    @MarkRendle Pƙed 24 dny +3

    It's crazy how simple Span is on the inside considering the impact it's had on .NET in recent years.

  • @mey33am
    @mey33am Pƙed 25 dny +1

    Keep posting Stephan! We need more content like this, Thank You

  • @wimzi9887
    @wimzi9887 Pƙed 18 dny +1

    I wanna watch Stephen build a complex project from start to finish. I would love to see how he works.

  • @dy0mber847
    @dy0mber847 Pƙed 25 dny +5

    Incredible as always

  • @draganradovac8803
    @draganradovac8803 Pƙed 12 dny

    Scott and Stephen are a great combo. Looking forward to future presentations.

  • @delphiguy23
    @delphiguy23 Pƙed 24 dny +2

    I saw Stephen Toub, I clicked.... freaking awesome presentation learned a lot from this.

  • @JavedaliShaikh-yy1jr
    @JavedaliShaikh-yy1jr Pƙed 11 dny

    Just Brilliant! Keep making more of these.. Thanks.

  • @freierNamen
    @freierNamen Pƙed 24 dny +1

    Oh no, it happened again!
    The video is over and I've already seen all parts of the series😱😂
    Thank you so much! Love every second of it...

  • @norm6096
    @norm6096 Pƙed 25 dny +2

    You guys are awesome combo, thanks for the videos! :)

  • @fatlumlatifi2897
    @fatlumlatifi2897 Pƙed 24 dny +1

    Excellent video, please keep Mr. Toub on a few more episodes. As of topics to cover if possible please make video on how to interop or preferably make binding of C libraries on .NET.

  • @tirgo007
    @tirgo007 Pƙed 24 dny

    Great stuff! Looking forward to the next one.

  • @levimatheri7682
    @levimatheri7682 Pƙed 20 dny

    Stephen Toub is my spirit animal. So smart!

  • @LasseVagstherKarlsen
    @LasseVagstherKarlsen Pƙed 24 dny +1

    Man, you guys nailed it as usual, absolutely love these videos. GC next? 🙂

  • @MehrdadSoltani-qn2ny
    @MehrdadSoltani-qn2ny Pƙed 25 dny +1

    one of the best demo/tutorials I have ever seen about Span.

  • @enijburg
    @enijburg Pƙed 25 dny

    Another great session! Keep them coming 🎉

  • @AskFiqri
    @AskFiqri Pƙed 23 dny

    This is a treat

  • @DavidPereira-lc1yq
    @DavidPereira-lc1yq Pƙed 24 dny

    This is freaking awesome!!! Right from the source, you should build a comprehensive "deep C# course" with all of this, for people that would like to purse perf related topics. Right now, I don't think there's a place where you can do that. It's basically spread around books, courses, blogs, etc etc.
    Really nice this one.

  • @SajadJalilian
    @SajadJalilian Pƙed 22 dny

    Dotnet has many layers of abstractions in a good way. They are like magic. Watching this series is like those videos in which a magician explains how they are doing their tricks under the hood. I love it.

  • @tayyabshaikh3286
    @tayyabshaikh3286 Pƙed 19 dny

    Pure Knowledge Sharing.. & No dumb podcast like others.. Truly Marvelous.
    ♄

  • @timur2887
    @timur2887 Pƙed 21 dnem

    Thank you very much! Great content!

  • @hashdynamics978
    @hashdynamics978 Pƙed 23 dny

    my new favorite tv show. Love it!

  • @user-yf8fi7lc5s
    @user-yf8fi7lc5s Pƙed 25 dny +3

    Like in the good old days of Channel 9 👍

  • @alexisfibonacci
    @alexisfibonacci Pƙed 24 dny +3

    I haven't seen Bart De Smet in years. Is he available to talk about IObservable? Why has there been less emphasis on it in recent times? Also IQbservable..

  • @ChaoticNeutral6
    @ChaoticNeutral6 Pƙed 20 dny

    That was wild, I definitely want to see a part 2. Would also be cool to go through stuff like MemoryMarshall and its methods

  • @uitumenj8380
    @uitumenj8380 Pƙed 25 dny

    I’m value added :))) thank you guys!

  • @sgwong513
    @sgwong513 Pƙed 20 dny

    its the only video I need to watch to learn what is Span in .net

  • @preet1979
    @preet1979 Pƙed 23 dny +1

    This was a great video. All I need now is another deep dive video into Memory to complete my understanding of it. Thanks again for such a great video.

  • @SimoLPers
    @SimoLPers Pƙed 17 dny

    The series is really great! Thanks for sharing! ME me I'd personally love to see how what lies under the hood of reflection.

  • @colhountech
    @colhountech Pƙed 24 dny +1

    Best Content On youtube today. I love the relaxed page and the high intensity content. It's almost an anti pattern of all the click-bate, gapless, b-roll crap on youtube today.
    If stephen does a workshop of stuff like this in NDC London next year, I'll drop $2000 to attend like when Dave and Damiean did the early workshops on .net core in circa 2017.

  • @SlackwareNVM
    @SlackwareNVM Pƙed 25 dny +2

    I'm interested in the meaning behind that last constructor check. Also, what are the tradeoffs from the alternative implementations you mentioned?
    Would love to know more about Memory as well. I don't yet have proper intuition of how to use it.

  • @GuildOfCalamity
    @GuildOfCalamity Pƙed 25 dny

    Keep doing these with Stephen; would like to see more roll-your-own content, like the Async/Task video.

  • @JakobStrasser
    @JakobStrasser Pƙed 25 dny

    Thanks, very informative!

  • @KvapuJanjalia
    @KvapuJanjalia Pƙed 7 dny

    Looking forward to deep dives into memory of T, sequence of T, pipes and buffers.

  • @dy0mber847
    @dy0mber847 Pƙed 25 dny

    Show must go on

  • @AndrzejPauli
    @AndrzejPauli Pƙed 23 dny

    StephenT and ScottH - nothing is better 🙂

  • @imranhussain8700
    @imranhussain8700 Pƙed 20 dny

    Async/Await
    LINQ
    RegEx
    Span
    😀😀😀😀😀😀😀😀😀😀😀😀😀😀
    Loving it.
    Thank you very much. Great Content.

  • @fedayka
    @fedayka Pƙed 24 dny

    The worst thing about this show is its time constraint! Great content guys! Amazing :)

  • @rodrigolima206
    @rodrigolima206 Pƙed 21 dnem

    Very nice explanation thanks a lot. I would like to see something related to streams and how they work I was always curious about that. If possible, of course. Thanks again .

  • @davidmasterson883
    @davidmasterson883 Pƙed 25 dny

    I just love these videos!

  • @nessitro
    @nessitro Pƙed 25 dny

    I love this! Tanmirt!

  • @WizardofWestmarch
    @WizardofWestmarch Pƙed 24 dny

    At 38:48 Toub is talking about how if you have a readonly span it will put it in the data block of the binary. Do things like ImmutableArray get the same benefit or is the JIT compiler extra aware of ReadOnlySpan to do that optimization?

  • @djchrisi
    @djchrisi Pƙed 24 dny +1

    28:30 unsafe ist really a great keyword because it truly scares developers off ;)

  • @mrqbboy
    @mrqbboy Pƙed 24 dny

    I'm going to repeat myself, but thanks Scott and Stephen.

  • @lolroflxd
    @lolroflxd Pƙed 25 dny +1

    Awesome ❀

  • @Corvinaification
    @Corvinaification Pƙed 25 dny

    Amazing!

  • @heischono4917
    @heischono4917 Pƙed 8 dny

    I wonder what Scott is using a floppy for? :D Wonderful video, I hope we get more f this kind. Greetings from Norway :)

  • @Aaron31056
    @Aaron31056 Pƙed 21 dnem

    Amazing

  • @schlott1970
    @schlott1970 Pƙed 25 dny +1

    My biggest question was how, using span, was the compiler able to keep such a tight loop when enumerating? Also could have mentioned that span does not allocate any memory or copy stuff around! This was a good one Scott/stephen! Thankyou

    • @davidantolingonzalez4929
      @davidantolingonzalez4929 Pƙed 22 dny

      It does allocate memory for the Span (two fields), but it does on the stack, not on the heap. Also, since it only stores an address of memory and an int, no copy of data is needed.
      The tight loop is achieved because T reference is basically a pointer so for enumerating the only thing it has to do is add "one" to the pointer times length, exactly the same as an array.

  • @dlandi
    @dlandi Pƙed 23 dny

    Riffing off "Naming is hard":
    Spam
    Hmmm.

  • @evarlast
    @evarlast Pƙed 4 hodinami

    Best C# feature in 10-15 yrs.

  • @anm3037
    @anm3037 Pƙed 23 dny

    Any interface for all collections (Array, List, etc) that can be converted to Span

  • @yonatan2608
    @yonatan2608 Pƙed 24 dny

    thank youuuu

  • @SahilDesai-sx3sn
    @SahilDesai-sx3sn Pƙed 24 dny

    knowledge SPANNING multiple videos.

  • @yonatan2608
    @yonatan2608 Pƙed 21 dnem

    These kind of videos should be in 202 schools.

  • @jr.BoarOfGold
    @jr.BoarOfGold Pƙed 25 dny

    I leave my instant like

  • @ivandrofly
    @ivandrofly Pƙed 15 dny

    34:31 - Pause
    39:00 - utf8 syntax from c# 11

  • @isaacayodejii
    @isaacayodejii Pƙed 24 dny

    too gooood!

  • @jackkendall6420
    @jackkendall6420 Pƙed 24 dny

    rubbed my hands together and cackled when I saw this

  • @robl39
    @robl39 Pƙed 23 dny

    Can you guys please deep dive the csc or the CLR?

  • @StackOverflowMan
    @StackOverflowMan Pƙed 10 dny

    "readonly ref struct" appears in C# 8, while Span appreared earlier in .net core 2, and than Span was just a struct.
    Would be interesting to see how it evolve.

  • @YuriBez2023
    @YuriBez2023 Pƙed 23 dny +1

    @37:11 - Stephen's fingers were off-by-one there.

  • @kamlezadeh
    @kamlezadeh Pƙed 9 dny

    Can we have a video explaining ArrayPool and MemoryPool please?

  • @Cymricus
    @Cymricus Pƙed 25 dny +1

    the people in chat being negative about copilot are gonna get behind if they don’t use the very powerful tools at our disposal.
    you really don’t want to be behind in a world with generative AI.

  • @MrHighway2000
    @MrHighway2000 Pƙed 25 dny

    Most Valuable Video of Span

  • @paulscarlett4346
    @paulscarlett4346 Pƙed 25 dny +2

    "Please - May I have more?"

  • @hashdynamics978
    @hashdynamics978 Pƙed 23 dny

    👏

  • @ivandrofly
    @ivandrofly Pƙed 15 dny

    At the beginning of the video, while using Rider and I'm like it's still hard to see the IL code in Visual Studio 😆😆

  • @user-od4ce8pe3u
    @user-od4ce8pe3u Pƙed 24 dny

    Idea for next video: exception under the hood

  • @davidelizalde3844
    @davidelizalde3844 Pƙed 25 dny

    Nice Invensible t-shirt

  • @kishananem
    @kishananem Pƙed 23 dny

    Hello Scott/ Stephen
    Please do videos about algorithms used in framework.
    Please like comments who interested in this. They may do video.

  • @rham1985
    @rham1985 Pƙed hodinou

    think i've heard is as:
    The two hardest things for programmers:
    * Naming things
    * Cache invalidation
    * Off by one errors

  • @imranhussain8700
    @imranhussain8700 Pƙed 19 dny

    Tell us in the comment what you like and what you don't like.
    There are five videos now and I am still figuring out what are don't like.
    is there anything in these videos that we don't like, I don't think so.

  • @__angle
    @__angle Pƙed 23 dny

    đŸ„°

  • @dskim2459
    @dskim2459 Pƙed 24 dny

    why dooes audio quality from .net never improve? please give them a good mic

  • @skarcade
    @skarcade Pƙed 23 dny +1

    How many times was he told to zoom in during this video? 🔍😂

  • @tedchirvasiu
    @tedchirvasiu Pƙed 19 dny +1

    C##