Wait, react is multi-threaded? - Nikhil Sharma

Sdílet
Vložit
  • čas přidán 15. 11. 2022
  • We already know, "if some task takes time, promisify it!". But some tasks can be computation heavy and can take time to complete, so making them async is of no use since those have to be anyway get picked. Solution? Simple, multithreading! Yeah I know that React and in turn JavaScript is single-threaded but what if I told you that our life was a lie ever since? Enter web workers! The web is single-threaded. This makes it increasingly hard to write smooth and responsive apps. Workers have a bad rep, but can be an important and useful tool in any web developer’s toolbelt for these kinds of problems. This talk would dive into the how we encounter some real-world scenarios with React like a search feature, and how web workers come to our rescue by helping us do intensive work in parallel, without blocking the main thread. We will also see how it relates to the brand new "Concurrent mode" feature, all of this with the fun of examples, Sounds interesting right? The talk reveals it all!
  • Věda a technologie

Komentáře • 5

  • @everestshadow
    @everestshadow Před rokem +4

    I wouldn't call it multi-threaded. It's forked process where you pay price for copying memory in and out from shared buffer as way of communication. It can be useful in some use case but also can be useless or even harmful for other cases.

    • @adamzalesak
      @adamzalesak Před rokem

      For instance, sorting of a huge array includes serializing to pass them as a message, which can take even longer the the sorting itself.

  • @user-xw6jr7ue4b
    @user-xw6jr7ue4b Před rokem

    Very useful talk, thanks!

  • @Pareshbpatel
    @Pareshbpatel Před 5 měsíci

    Excellent talk. Thank you, Nikhil.
    {2024-02-13}

  • @muhammadanshorjihadi7382

    Could you share the codesandbox link?