I messed up. I'm sorry.

Sdílet
Vložit
  • čas přidán 27. 03. 2024
  • Use code EASTER25 for 25% off any course, EASTER15 for 15% off any bundle or EASTER10 for 10 off your first year of Dometrain Pro on Dometrain: dometrain.com
    Become a Patreon and get special perks: / nickchapsas
    Hello, everybody, I'm Nick, and in this video I will address a mistake I did in my previous video regarding search values.
    Workshops: bit.ly/nickworkshops
    Don't forget to comment, like and subscribe :)
    Social Media:
    Follow me on GitHub: github.com/Elfocrash
    Follow me on Twitter: / nickchapsas
    Connect on LinkedIn: / nick-chapsas
    Keep coding merch: keepcoding.shop
    #csharp #dotnet

Komentáře • 140

  • @IceQub3
    @IceQub3 Před měsícem +108

    Bro was wrong and got a free video topic as a present. 10/10 business

  • @antonioamaral400
    @antonioamaral400 Před měsícem +136

    There are only 2 types of people that "don't make mistakes". Those that don't do anything and those that won't admit them.
    Viewers: "Come for the tech value, stay for the human value".
    Keep up the good work Nick

  • @AdolfoFoliaco
    @AdolfoFoliaco Před měsícem +43

    so true, I'm still reading last year's performance blog

  • @bogella2225
    @bogella2225 Před měsícem +74

    A true cop would do a self review and find no wrong doing

  • @margosdesarian
    @margosdesarian Před měsícem +75

    Thats it Nick. I was going to introduce you to my beautiful daughter, but thats not happening now. Your loss.

  • @DevDunkStudio
    @DevDunkStudio Před měsícem +18

    Mistakes are fine, it's how you respond which matters. And this is the best way to do it.
    Appreciate the transparency

  • @vitalydushkin
    @vitalydushkin Před měsícem +11

    I don't think you have messed up. I'm going through MS docs now, and they don't make any sense, and have no examples. Went to see a couple of articles, they also fail to deliver. Your videos showed a few real world use cases. But thanks for the follow up. Also Nick, would it be possible for you to add to the title "SearchValues" so it would be easier to find this video in the future? I like to use your videos as a point of reference from time to time, and descriptive title or/and tags greatly improve searchability. Thanks!

    • @nebuleon
      @nebuleon Před měsícem

      Seconding this. Maybe a name like "SearchValues on strings, part 2: IndexOfAny" when the "clickbait window" is closed?

  • @Placeholderhandle1
    @Placeholderhandle1 Před měsícem +75

    I will always forgive you, brother Nick.

    • @hasmich
      @hasmich Před měsícem +1

      Given a mistake has been admitted in the first place ;)

  • @Szwarcus15
    @Szwarcus15 Před měsícem +3

    4:54 hahaha this makes me laugh 😂 Good job, really impressive that he reached you and that you shared this with us 🔥

  • @IllidanS4
    @IllidanS4 Před měsícem +2

    It's okay. At least you did not sing the apology.
    To be honest I did not give so much attention to the previous video but I immediately recalled memories of learning about Aho-Corasick and other text searching algorithms, so I already knew where this would have been going. I would love to know more about what this algorithm is or what the structure behind it looks like. Perhaps it is the hashing-based searching too.

  • @gilroitto
    @gilroitto Před 29 dny +1

    Curious about the algorithm. My best guess as many here is a modified version of Boyer-Moore or Boyer-Moore-Hoorspool algorithm, where the pre-processing combines all the search words into combined table(s). Edge cases that would challenge the performance would be high Unicode characters, many search strings that cover the whole alphabet, and search in texts with few characters (e.g. DNA sequences).

  • @ProfBits
    @ProfBits Před měsícem +3

    Ok, nice to heare. However in this case you should the simplest but worst possible way to do the computation as a base line. Therfor how would a Boyer-Moore string-search algorithm implementation stack up against search values or is it simmilar? It would be simmillar if search values uses it in the backend, however I haven't checked that.

  • @CalebJenkinsOnGoogle
    @CalebJenkinsOnGoogle Před 29 dny

    It's all good Nick! I love the transparency and opportunities that come with doing so much in public. Keep that excellent content coming our way!

  • @persehlin4379
    @persehlin4379 Před 27 dny

    Thanks! That's why I trust you and your videos. You are so eager to do things correctly that you even evaluate your own videos. Fantastic!

  • @99MrX99
    @99MrX99 Před měsícem +1

    Is there also a method to return the found value so one can e.g. switch over it from the different values one searched for?

  • @bogdan.p
    @bogdan.p Před měsícem +9

    We appreciate your transparency Nick. It's great you did a follow up on this. Nobody knows everything.

  • @superpcstation
    @superpcstation Před měsícem

    Hi nick, why did you reassign NeedleArray and Haystack to local variables inside the IndexOfFirstArray?

  • @leopoId
    @leopoId Před měsícem

    So it is for finding strings in a long paragraphs, not in a string array. Good point but are there any mentions about it on Docs?

  • @paulecampbell
    @paulecampbell Před měsícem

    Man, Stephen is legendary and I know that's where Nick is heading. I literally just watched a video with Stephen explaining how async/await works internally - epic! Thanks for sharing this with us Nick. I have even more confidence in you now that I know that you will not hesitate to call out yourself!

  • @d347hm4n
    @d347hm4n Před měsícem +12

    Transparency and integrity, nice to see. :)

  • @vekzdran
    @vekzdran Před měsícem +1

    A major lesson in public communication and audience control. Kudos Nick.

  • @genyalubin
    @genyalubin Před měsícem +2

    How does IndexOfAny work behind the scene? Why is it so performant?

  • @tedchirvasiu
    @tedchirvasiu Před měsícem +2

    Damn, I was just reading Stephen Toub's "Building Async Coordination Primitives" blog posts from 2012 today and now he gets mentioned.

  • @LasseVagstherKarlsen
    @LasseVagstherKarlsen Před měsícem +7

    I agree, this is a much better showcase for the benefits of that class, nice of you to come back with an update :)
    This suggests that what this class does is to create a DFA or similar for use with an algorithm similar to Boyer-Moore, that instead of just blindly iterating one character at a time over the text to search, actually uses the knowledge of what it is searching for to be able to skip faster through the text. I say "similar" because I have not kept myself updated on such algorithms and undoubtedly there are even better algorithms these days.

    • @_mihazupan
      @_mihazupan Před 26 dny

      For the example given (3 ASCII values), the implementation would currently use an algorithm called "Teddy" that lets us look for prefixes of multiple values in a vectorized manner

  • @jvquiles
    @jvquiles Před měsícem

    Recognizing errors makes you a great person. This kind of things are really motivating to follow your videos 🙂

  • @fusedqyou
    @fusedqyou Před měsícem +48

    That's it, I'm switching to Java now

    • @mikestiver9000
      @mikestiver9000 Před měsícem +39

      "It hurt itself in its confusion".

    • @adambickford8720
      @adambickford8720 Před měsícem +22

      Ironic because I'm a java dev that follows c# to see where we'll be in ~5 years

    • @alissoncandatem1896
      @alissoncandatem1896 Před měsícem

      @@adambickford8720 the sneak eating it's on tale

    • @AnsisPlepis
      @AnsisPlepis Před měsícem +2

      We mainly use dotnet where I work, and during a board session, we had to assign tasks. One of them was upgrading dependencies in a Java plugin. When no one offered to take the task, scrum master shyly said “Java? Anyone?” as if to convince someone. That was the funniest and most awkward silence on the job, and sometimes when I see Java I realise just how glad I am to have moved past it

  • @utubekade
    @utubekade Před měsícem +1

    Now this makes much more sense. Great feature!

  • @carlosalmeida2847
    @carlosalmeida2847 Před měsícem

    I wouldn’t say you messed up, I’d say you came with a part 2 video with even more detailed, in-depth and thorough information! Congrats!

    • @jcmorin2007
      @jcmorin2007 Před 26 dny

      It's a "messed" in a sense it didn't show anything. When I saw the original video I've immediately told myself, how is that better than a hashset with a case insensitive comparer. So happy how I get the answer.

  • @krccmsitp2884
    @krccmsitp2884 Před měsícem

    Thanks foe clarification.

  • @muhamedkarajic
    @muhamedkarajic Před měsícem

    I was worried when I saw the title. You had me there worried for a couple of seconds Nick.

  • @RamonSmits
    @RamonSmits Před měsícem +3

    FrozenSet might be even more efficient

  • @acedonk
    @acedonk Před měsícem

    I am proud of you. Very few mere mortals gets humbled by Stephen Toub, you took it like a boss.
    Keep coding.

  • @tanglesites
    @tanglesites Před měsícem

    Nobody is perfect Nick. The fact you deem an omission a mistake regardless the reason for the omission only makes me like this channel more. I’m sure most of us didn’t even notice.
    Thanks for the “update”.

  • @SlackwareNVM
    @SlackwareNVM Před měsícem

    Title sounds like one for an influencer apology video. Thanks for the correction, tho. The feature looks pretty amazing.

  • @mrcarlpaton
    @mrcarlpaton Před měsícem

    You still smarter than I'll ever be and I'm a better engineer because of all your other content and courses. Keep coding brother ❤

  • @GiovanniCostagliola
    @GiovanniCostagliola Před měsícem +2

    Press F to pay respect

  • @JRyomaru
    @JRyomaru Před měsícem

    Nick title should include info about what it is. We search (lol) for these in the future,

  • @cocoscacao6102
    @cocoscacao6102 Před měsícem

    "I owe you an apology" ...and money I'd add... My billion dollar startup just failed due to bad information from YT.

  • @vitalmarc
    @vitalmarc Před měsícem +2

    How does this compare with old school Regex?

    • @jongeduard
      @jongeduard Před 24 dny

      Depends on your regex implementation. There are quite a lot. The Dotnet regex engine is quite a fast one, but also quite large in features, while in Rust you get basically the fastest implementation on the planet I believe, but with more limited features.
      But still things like SearchValues may still win over all of these, since you dedicate it to very specific things to search for and not a whole regex engine has to sit behind it.
      However, this is all my thoughts. the real way to know is just to benchmark it. Very simple.

  • @hasmich
    @hasmich Před měsícem

    It's great you made this video and did it so fast. Everyone makes mistakes, but it takes guts to admit it.

  • @C00l-Game-Dev
    @C00l-Game-Dev Před měsícem

    Do you have any reosurces that explain how this works behind the scenes?

  • @Bennevisie
    @Bennevisie Před měsícem +1

    Integrity move, brother

  • @TonoNamnum
    @TonoNamnum Před 27 dny

    How long it takes to cast it to a searchValues?

  • @C00l-Game-Dev
    @C00l-Game-Dev Před měsícem

    Thank you for being honest and owning up. As long as you admit it, your cool.👍

  • @peterk4694
    @peterk4694 Před měsícem

    That was nothing. You should see the mistake I made. Much respect Nick

  • @IIARROWS
    @IIARROWS Před měsícem +2

    You could call this "Code COP Me"

  • @imavalverde
    @imavalverde Před 29 dny

    Very nice to admit your own mistakes, keep doing amazing work.

  • @CharlesBurnsPrime
    @CharlesBurnsPrime Před měsícem

    Were it possible for me to respect you more than I already do, sincerely apologizing for a legitimate mistake would have increased that respect further still.

  • @o0ooCrossboneoo0o
    @o0ooCrossboneoo0o Před měsícem

    awwwww Nick please dont cry...

  • @DotNetCookbook
    @DotNetCookbook Před měsícem +1

    Now this makes much more sense! Thank you! What’s still unclear to me is the use case scenario for search values on any type that is not a string/char.

  • @nikolayzdravkov1378
    @nikolayzdravkov1378 Před 27 dny

    Guess it should have been compared with FrozenSet not with HashSet? :D

  • @FroxerBBQ
    @FroxerBBQ Před 27 dny

    We all human, thanks for making videos!

  • @ichigoslayer84
    @ichigoslayer84 Před 28 dny

    One of the best keep it up!

  • @pavlindrom
    @pavlindrom Před měsícem +9

    I thought you were going to reneg the episode where you trashed the byte backing field for enums, which I have done recently. I'll await your apology for that too.

    • @nickchapsas
      @nickchapsas  Před měsícem +4

      lolno

    • @promant6458
      @promant6458 Před měsícem +2

      Apology? Why tho

    • @pavlindrom
      @pavlindrom Před měsícem +1

      @@promant6458 tongue in cheek comment, since I used it before, it can't be bad, right? I do concede the video had good points.

  • @charlesaboujawdeh
    @charlesaboujawdeh Před měsícem +5

    Hey Nick, I really find your videos useful and I wish I could afford your dometrain courses and support you. I'm from Lebanon but I find them too expensive for us since our income is so low specially because of the economic crisis we've been in for almost 5 years now :(

    • @hernanar3647
      @hernanar3647 Před měsícem +4

      Yeah, a course price specific based on the country might be a good idea for people of countries with less resources

  • @cs96ai
    @cs96ai Před měsícem

    Good job!

  • @queenstownswords
    @queenstownswords Před měsícem

    A small video bug. All good mate! Fix verified.

  • @robl39
    @robl39 Před měsícem

    I guess it still wasn’t clear to me why this is better than a hash set or hash map. What is the summary here? Why would you use this over the hash set or map?

  • @RandalGJunior
    @RandalGJunior Před 29 dny

    Could you talk about redis alternatives? please

  • @CarrigansGuitarClub
    @CarrigansGuitarClub Před měsícem

    It's called due diligence!

  • @leknyzma
    @leknyzma Před měsícem

    hi Stephen

  • @comediehero
    @comediehero Před měsícem +1

    Always nice to see someone admit mistakes and fix them. Mad respect!

  • @reikooters
    @reikooters Před měsícem

    Good follow up. On the last video I assumed this was the actual use case just because this is essentially what the previous characters one was doing (needless in a haystack type thing). But nice to see an actual benchmark showing the feature.

  • @TheBlackNathaniel
    @TheBlackNathaniel Před měsícem

    Thank you for clearing that up!
    Keep up the good work, Nick. Thank you so much!

  • @Pingouin583
    @Pingouin583 Před měsícem

    I thought he was going to apologize for talking badly about stored procedures

  • @theprantadutta
    @theprantadutta Před měsícem

    Never knew you are a Marvel fan

  • @Fred-yq3fs
    @Fred-yq3fs Před měsícem +2

    High standards, as always. Thanks.

  • @AnsisPlepis
    @AnsisPlepis Před měsícem

    You have to be the most genuine and honest CZcamsr I know. And your content is always amazing and informative. Keep it up

  • @mintx1720
    @mintx1720 Před 29 dny

    Nick should learn to see sharp this time.

  • @rouensk
    @rouensk Před 28 dny

    Nick, kudos for making fix video. But if you truly "hold yourself to the standards", stop with cheap clickbait titles and name it properly.

  • @JeremyPyne
    @JeremyPyne Před měsícem

    Sure. But how does this compare to regex.

  • @BlingPiece
    @BlingPiece Před měsícem

    It’s just not good enough Nick

  • @JamyRyals
    @JamyRyals Před měsícem

    Good correction, we all make mistakes!

  • @Robert-yw5ms
    @Robert-yw5ms Před měsícem

    Haven't watched yet no idea what this is about just wanted you to know I don't forgive you and never will.

  • @pedrosilva1437
    @pedrosilva1437 Před 23 dny

    You should have Code Copped yourself... 😂

  • @PedroPabloCalvoMorcillo
    @PedroPabloCalvoMorcillo Před měsícem

    Phenomenal

  • @Ristogod
    @Ristogod Před měsícem

    Dang, now I don't have a valid use-case to use this feature.

  • @dongler4589
    @dongler4589 Před měsícem

    Im rarely this early, minute 1?

  • @_Tangent_
    @_Tangent_ Před měsícem +2

    thats it im switching to java

  • @Kangoo9
    @Kangoo9 Před měsícem +8

    I hate clickbait, why don’t you just sum up your mistake in video title ?

    • @RainFerret
      @RainFerret Před měsícem

      Don't watch Nick if you dislike clickbait

    • @nickchapsas
      @nickchapsas  Před měsícem +1

      You must be new

    • @RainFerret
      @RainFerret Před měsícem

      @@nickchapsas I've watched all your videos for about 6 months. The content is wonderful, and the titles and thumbnails are complete clickbait style. Just what I like.

  • @cvelebele18
    @cvelebele18 Před měsícem

    blazingly fast

  • @ryan-heath
    @ryan-heath Před měsícem

    Main take away: search values is insanely fast 😎

  • @StefanoTempesta
    @StefanoTempesta Před 25 dny

    Ok we forgive you, but... what are you wearing??

  • @nertsch77
    @nertsch77 Před měsícem +1

    What, if you would use "haystack.AsSpan().IndexOf(needle, StringComparison.OrdinalIgnoreCase)" ? (of course move aystack.AsSpan() outside the loop and do a Math.Min() over the sucessfull needle hits)

  • @VakkaHUN
    @VakkaHUN Před měsícem +1

    You should apologize for the clickbait title and thumbnail.

  • @bloggrammer
    @bloggrammer Před měsícem

    The thumbnail shouldn't used the cop cap😅
    So you're not forgiven yet😂

  • @thedjtko
    @thedjtko Před měsícem

    That’s it, I’m unsubscribing

  • @Leon-ph7br
    @Leon-ph7br Před měsícem +1

    Yes, you ruined my entire career. Love your content btw.

  • @Knuckles2761
    @Knuckles2761 Před měsícem

    Shame! Shame! Shame!

  • @throwaway6288
    @throwaway6288 Před měsícem +2

    Sorry nick but this time you went too far. It’s too late to apologize 😔

  • @johan_za
    @johan_za Před 25 dny

    Get a life!

  • @user-yb8ck6cf2m
    @user-yb8ck6cf2m Před měsícem

    This happens when you try to release video quickly just for the self promo...

  • @thefattysplace
    @thefattysplace Před měsícem

    How exactly is that range operator working? Doesn't that load the whole remainder of the string each time? Wouldn't it be better to use contains in that case, or just use the range appropriate to the length of the needle? I.e [i..(i-needle.length)]? What am I missing here?

    • @TheAceInfinity
      @TheAceInfinity Před měsícem

      The range operator on a span is NOT like Substring. It creates a Range which is like calling for a Slice. It's only a Substring if used on a string...

    • @thefattysplace
      @thefattysplace Před měsícem

      @@TheAceInfinity but isn't that slice still huge at the start of this loop? instead of just getting a smaller slice limited to the same length as the needle?

    • @TheAceInfinity
      @TheAceInfinity Před měsícem

      @@thefattysplace I'd say the size of the slice is irrelevant regardless because the entire point of span is to reduce memory allocations. Only the start and end indices are stored. You should learn about how spans work.

    • @thefattysplace
      @thefattysplace Před měsícem

      @@TheAceInfinity sorry I wasn't referring to the memory optimisation, the size of the span wouldn't affect this as it's just a reference to the start and end points within a string. I was referring to the speed. I guess it depends on what operations are done in startswith, and if it is affected by length. But then that brings me back to using contains instead on the full string. Just for fun I might do my own benchmarks and see using the same source string.

    • @thefattysplace
      @thefattysplace Před měsícem

      @@TheAceInfinity I ran the benchmarks with two new tests and the results show using a smaller slice gives a 0.89 ratio to using the full remaining span. Using contains was actually pretty close to using searchvalues. But using searchvaules still wins hands down. Results were:
      | IndexOfFirstArray | 7,934.59 us | 1.00 | 22 B | 1.00 |
      | BoolContainsArray | 164.78 us | 0.02 | 2 B | 0.09 |
      | IndexOfFirstSmallSliceArray | 6,982.63 us | 0.89 | 110 B | 5.00 |
      | IndexOfFirstSearchValues | 86.34 us | 0.01 | 2 B | 0.09 |

  • @MayronDev
    @MayronDev Před měsícem

    I memorised that code (dQw4w9WgXcQ) so I know exactly what it is every time I see it online or spray painted around town lol

  • @bloggrammer
    @bloggrammer Před měsícem

    The thumbnail shouldn't used the cop cap😅
    So you're not forgiven yet😂