PROOF JavaScript is a Multi-Threaded language

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ส.ค. 2023
  • Learn the basics of parallelism and concurrency in JavaScript by experimenting with Node.js Worker Threads and browser Web Workers.
    #javascript #programming #computerscience
    Upgrade to Fireship PRO fireship.io/pro
    Node.js Worker Threads nodejs.org/api/worker_threads...
    Check out @codewithryan • Node.js is a serious t...

ความคิดเห็น • 528

  • @daedalus5070
    @daedalus5070 10 หลายเดือนก่อน +1496

    I could feel my brain trying to stop me writing what I knew was an infinite loop but I did it anyway. I trusted you Jeff!

    • @ko-Daegu
      @ko-Daegu 10 หลายเดือนก่อน +23

      0:31 concurrency incorporates parallelism
      what you should is asynchronism

    • @lucassilvas1
      @lucassilvas1 10 หลายเดือนก่อน +74

      @@ko-Daegu who are you talking to, schizo?

    • @hypergraphic
      @hypergraphic 10 หลายเดือนก่อน +4

      me too!

    • @universaltoons
      @universaltoons 10 หลายเดือนก่อน +29

      @@ko-Daegu can I have some of what you're having

    • @lengors7327
      @lengors7327 10 หลายเดือนก่อน +11

      ​@@ko-Daegu you really thought you are being smart with that remark, didnt you? Only problem is that you are wrong

  • @AlecThilenius
    @AlecThilenius 10 หลายเดือนก่อน +328

    Fun nerd trivia:
    - A single CPU core runs multiple instructions concurrently, the CPU core just guarantees that it will appear AS IF the instructions were run serially within the context of a single thread. This is achieved primarily via instruction pipelining.
    - A single CPU core often executes instructions totally out of order, this is unimaginatively named "Out Of Order (OOO) execution".
    - A single core also executes instructions simultaneously from two DIFFERENT threads, only guaranteeing that each thread will appear AS IF it ran serially, all on the same shared hardware, all in the same core. This is called Hyperthreading.
    And we haven't even gotten to multi-core yet lol. I love you content Jeff, the ending was gold!

    • @ragggs
      @ragggs 10 หลายเดือนก่อน +19

      in the spectre and meltdown era, we like to say “guarantees”

    • @RicardoSilvaTripcall
      @RicardoSilvaTripcall 10 หลายเดือนก่อน +6

      But in a Hyperthreaded systems tasks just do not appear to be executed serially, they actually are executed serially ... the only difference is that the system is going to coordinate the execution of other tasks/threads while waiting for the previous one, that is probably blocked waiting for a I/O response ...
      If you have a 16 core processor with 32 logical processors, it doesn't mean it can execute 32 thread simultaneously ...

    • @ragggs
      @ragggs 10 หลายเดือนก่อน +2

      @@RicardoSilvaTripcall hyperthreads are in many cases parallel by most meaningful definitions, due to interleaved pipelined operations on the cpu, and the observability problem of variable length operations. For an arbitrary pair of operations on two hyperthreads, without specifying what the operations are, and the exact cpu and microcode patch level you can not say which operation completes first even if you know the order in which they started.

    • @AlecThilenius
      @AlecThilenius 10 หลายเดือนก่อน

      @@ragggs Lol! Maybe guarantee* (unless you're Intel)

    • @AlecThilenius
      @AlecThilenius 10 หลายเดือนก่อน

      @@RicardoSilvaTripcall Uhhhh. No. Sorry.

  • @WolfPhoenix0
    @WolfPhoenix0 10 หลายเดือนก่อน +68

    That chef analogy about concurrency and parallelism was genius. Makes it SO much easier to understand the differences.

  • @RedlinePostal
    @RedlinePostal 10 หลายเดือนก่อน +247

    Also when we say "one-core," that means "one-core at a *time*" -- computer kernels are concurrent by default, and the program's code will actually be constantly shifting to different CPUs, as the kernel manages a queue of things for the processor to do. Not too unlike the asynchronous system that javascript has, kernel will break each program you're running into executable chunks, and has a way to manage which programs and code get more priority.

    • @orbyfied
      @orbyfied 10 หลายเดือนก่อน +7

      wouldnt that be kind of ineffective though, it wouldnt be able to take full advantage of the CPU cache, so i hope it does it as rarely as possible

    • @invinciblemode
      @invinciblemode 10 หลายเดือนก่อน +17

      @@orbyfieduhh, different CPU cores use the same L2-L3 cache. L1 Cache is per core but they’re small and meant for minor optimisations.

    • @orbyfied
      @orbyfied 10 หลายเดือนก่อน +6

      L1 is the fastest so having data available there is pretty significant. its also grown much in size to the point that it can basically cache all the memory a longer running task will need now. if L1 was so insignificant it wouldn't cause there data desync issues across threads

    • @LettersAndNumbers300
      @LettersAndNumbers300 10 หลายเดือนก่อน +1

      Then…why do I only see one core active when running simple Python code…?

    • @jesusmods1
      @jesusmods1 10 หลายเดือนก่อน +3

      ​@@orbyfiedit could be more inefficient if only one process took all the CPU core for himself during all his life time. Probably the process isn't switched between cores, but it is being swaped in and out with others on the same core for the sake of concurrency. Also take in account the hit rate that a cache may have.

  • @JThompson_VI
    @JThompson_VI 10 หลายเดือนก่อน +96

    Moments like 0:52, the short memorable description of callback functions, is what makes you a great teacher. Thanks man!

    • @kisaragi-hiu
      @kisaragi-hiu 10 หลายเดือนก่อน +1

      Keep in mind the JS world also calls any higher order function "callback" (like the function you'd pass to Array.map), whereas elsewhere afaik it only refers to the function you pass to something non-blocking.

    • @curlyfryactual
      @curlyfryactual 10 หลายเดือนก่อน +2

      ​@@kisaragi-hiu a fact that caused me much grief coming into JS from systems level.

  • @elhaambasheerch7058
    @elhaambasheerch7058 10 หลายเดือนก่อน +64

    Love to see jeff going in depth on this channel, would love more videos like this one.

    • @beyondfireship
      @beyondfireship  10 หลายเดือนก่อน +67

      That's why I made this channel. I've got a long list of ideas.

    • @morezco
      @morezco 10 หลายเดือนก่อน +1

      @@beyondfireship wonderful. Keep it up

  • @ra2enjoyer708
    @ra2enjoyer708 10 หลายเดือนก่อน +195

    It's a pretty good overview on how much more of a clusterfuck the code becomes once you add workers to it. And it didn't even get to the juice of doing fs/database/stream calls within workers and error handling for all of that.

    • @dan_le_brown
      @dan_le_brown 10 หลายเดือนก่อน +9

      "Clusterfuck", I had the same word in mind 😭😂

    • @ko-Daegu
      @ko-Daegu 10 หลายเดือนก่อน

      0:31 concurrency incorporates parallelism
      what you should is asynchronism

    • @angryman9333
      @angryman9333 10 หลายเดือนก่อน

      just use Promises, it'll process all your asynchronous functions concurrently (very similar to parallel)

    • @SirusStarTV
      @SirusStarTV 10 หลายเดือนก่อน +13

      @@angryman9333 Promise will run user written function in main thread blocking manner. Async function is just syntactic sugar for easier creation of promises. WIthout browser asynchronous api's or web workers it doesn't run code in parallel mode.

    • @platinumsun4632
      @platinumsun4632 10 หลายเดือนก่อน

      @@angryman9333a what?

  • @srejonkhan
    @srejonkhan 10 หลายเดือนก่อน +27

    6:13 To see how all of your cores utilizing, you can change the graph from 'Overall utilization' to 'Logical Processor' just by right clicking on the graph -> Change graph to -> Logical Processor.

  • @H-Root
    @H-Root 10 หลายเดือนก่อน +74

    I am stuck step programmer 😂😂

    • @rizkiaprita
      @rizkiaprita 10 หลายเดือนก่อน +1

      rule #34 is calling

    • @nullbeyondo
      @nullbeyondo 10 หลายเดือนก่อน +3

      break;

    • @catswolo421
      @catswolo421 6 หลายเดือนก่อน

      I would watch out or youll het multi threaded

  • @yss64
    @yss64 10 หลายเดือนก่อน +5

    Thanks for shouting out code with ryan! That channel is criminally underrated

  • @user-fed-yum
    @user-fed-yum 10 หลายเดือนก่อน +2

    That ending was possibly one of your best pranks ever, a new high watermark. Congratulations 😂

  • @BRBS360
    @BRBS360 10 หลายเดือนก่อน +36

    I'd like to see a video on JavaScript generators and maybe even coroutines.

    • @StiekemeHenk
      @StiekemeHenk 10 หลายเดือนก่อน

      For sure, this is a really cool thing and I'm not sure how to actually use it.

    • @ko-Daegu
      @ko-Daegu 10 หลายเดือนก่อน +2

      generics maybe ?
      garbage collector in more details ?
      benchmarkign agiants pythonic code, just to get people triggered ?

  • @deneguil-1618
    @deneguil-1618 10 หลายเดือนก่อน +78

    just a heads up for your CPU; the 12900K doesn't have 8 physical cores, it indeed has 16, 8 performance and 8 efficiency cores, the performance cores have hyperthreading enabled but not the efficiency cores so you have 24 threads in total

    • @daleryanaldover6545
      @daleryanaldover6545 10 หลายเดือนก่อน +1

      😮

    • @allesarfint
      @allesarfint 10 หลายเดือนก่อน +3

      Oh yeah, right. So that's why the CPU didn't go to 100% after using 8 cores.

    • @godnyx117
      @godnyx117 10 หลายเดือนก่อน +1

      You forgot the: 🤓

    • @adityaanuragi6916
      @adityaanuragi6916 10 หลายเดือนก่อน +9

      But at 6:57 his cpu did go to a 100% with 16

    • @wertrager
      @wertrager 10 หลายเดือนก่อน

      because hyperthreading is shit

  • @dzhaniivanov5837
    @dzhaniivanov5837 10 หลายเดือนก่อน +1

    i watched a similar video early this year, but your way to deliver content is amazing, keep going

  • @7heMech
    @7heMech 10 หลายเดือนก่อน +1

    Really cool, I actually saw the other video about nodejs taking it up a notch when it came out.

  • @kiprasmel
    @kiprasmel 10 หลายเดือนก่อน +2

    the `threads` package makes working with threads much more convenient. it also works well w/ typescript.

  • @EdgeGaming
    @EdgeGaming 10 หลายเดือนก่อน +1

    Lots of comments about memorable descriptions, shoutout to the thread summary at 3:30. Your conciseness is excellent.

  • @wjlee7003
    @wjlee7003 10 หลายเดือนก่อน +5

    although it's called concurrent, schedulers still can only work on one task at a time. It will delegate a certain amount of time to each task and switch between them (context switching). The switch Is just fast enough to make it seem truly "concurrent". If a task takes longer than the delegated time, the scheduler will still switch and come back to it to finish.

  • @nuvotion-live
    @nuvotion-live 10 หลายเดือนก่อน +37

    Little known fact, you can also do DOM related operations on another thread. You have to serve it from a separate origin and use the Origin-Agent-Cluster header, and load the script in an . But you can still communicate with it using postMessage, and avoid thread blocking with large binary transfers using chunking. This is great for stuff that involves video elements and cameras.
    I use it to move canvas animations (that include video textures) off the UI thread, and calculating motion vectors of webcams.

    • @knoopx
      @knoopx 10 หลายเดือนก่อน +1

      that looks handy! thanks for sharing

    • @among-us-99999
      @among-us-99999 10 หลายเดือนก่อน +1

      that might just help with a few of my projects

    • @matheusvictor9629
      @matheusvictor9629 10 หลายเดือนก่อน +1

      do you have any examples on github?

    • @nuvotion-live
      @nuvotion-live 10 หลายเดือนก่อน

      @@matheusvictor9629 yes

    • @andrewmcgrail2276
      @andrewmcgrail2276 10 หลายเดือนก่อน

      Sounds very interesting! I have a project where I think this would be useful.

  • @boris---
    @boris--- 10 หลายเดือนก่อน +2

    Task Manager --> Performance tab --> CPU --> Right click on graph --> Change graph to --> Logical Processors

  • @ahmad-murery
    @ahmad-murery 10 หลายเดือนก่อน +28

    It would be nice if you right click on the cpu graph and *Change graph to > Logical Processors*, so we can see each thread separately.
    Thanks!

    • @crackwitz
      @crackwitz 10 หลายเดือนก่อน +1

      less useful than you might think. the operating system's scheduler may bounce a thread around on any number of cores. doesn't make it faster but spreads the utilization around.

    • @ahmad-murery
      @ahmad-murery 10 หลายเดือนก่อน

      @@crackwitz Do you mean that we will not see each core graph plotting one thread?

  • @MrPman1999
    @MrPman1999 8 วันที่ผ่านมา

    best comic relief at the end ever, love you Jeff

  • @maxijonson
    @maxijonson 10 หลายเดือนก่อน +7

    My brain: dont run it
    8 years of programming: dont run it
    the worker thread registering my inputs to the console as I type it: dont run it
    Jeff: run it.
    **RUNS IT**

  • @AntonisTzorvas
    @AntonisTzorvas 10 หลายเดือนก่อน +1

    aside from the outstanding quality, this ending was quite funny and hilarious! keep it up, your content is TOP 🙇🚀

  • @Ihavetoreturnsomevideotapes
    @Ihavetoreturnsomevideotapes 10 หลายเดือนก่อน

    ayo , was learning event loop and had a bit of confusion about performance b/w single and multithreading and jeff just posted the video at the right time.

  • @AlexEscalante
    @AlexEscalante 10 หลายเดือนก่อน +1

    ¡Wow! Just yesterday I was watching some videos about worker threads because I will use them to speed up the UI in my current development 😄

  • @TeaBroski
    @TeaBroski 10 หลายเดือนก่อน +3

    It's like you read my client's requirement and came into support

  • @Bell_420
    @Bell_420 4 หลายเดือนก่อน

    the cook analogy was great and i now understand

  • @robertjif6337
    @robertjif6337 10 หลายเดือนก่อน +1

    Thanks, now I know what script I should include in my svgs

  • @adaliszk
    @adaliszk 10 หลายเดือนก่อน

    You can also pass initial data without needing to message the thread to start working, however, that one I feel like its better to use for initialization like connecting to a database.

  • @wusluf
    @wusluf 10 หลายเดือนก่อน

    Adding more cores might still provide gains in a VM scenario depending on the hypervisor. As long a your VM isn't provisioned all physical cores the hypervisor is at liberty to utilize more cores and even up to all physical cores for a short amount of time resulting in increased performance for bursting tasks

  • @Quamsi
    @Quamsi 10 หลายเดือนก่อน +34

    I have had hours long lectures in college level programming classes on the differences between concurrency and parallelism and the first 3 minutes of this video did a better job of explaining it. Shout outs to my bois running the us education system for wasting my money and my time 💀

    • @maskettaman1488
      @maskettaman1488 10 หลายเดือนก่อน +11

      It's probably not their fault you failed to understand something so simple. Literally 1 minute on google would have cleared up any misunderstanding you had

    • @TechBuddy_
      @TechBuddy_ 10 หลายเดือนก่อน

      ​@@maskettaman1488if you have to pay to study and then you have to sell yourself to a tech corp to learn something is not that great of a system and it should not exist IMHO

    • @Quamsi
      @Quamsi 10 หลายเดือนก่อน +7

      @maskettaman1488 lmao im not saying i misunderstood it im saying fireship is much more consice and still gets all the relevant information across compared to college despite the fact that i dont have to pay fireship anything

  • @timschannel247
    @timschannel247 หลายเดือนก่อน

    Yes Yes Yes, and exactly extra Yes! Thank you Bro for this contribution! You are speaking out of my brain! Best Regards!

  • @frankdearr2772
    @frankdearr2772 5 หลายเดือนก่อน

    great topic, thanks 👍

  • @junama
    @junama 10 หลายเดือนก่อน +16

    Good vídeo!
    Next time change the CPU graph with right click to see each threat graph.
    Hope it helps!

    • @LedimLPMore
      @LedimLPMore 10 หลายเดือนก่อน

      Wow, didn't know that. Thanks!

  • @DumbledoreMcCracken
    @DumbledoreMcCracken 10 หลายเดือนก่อน +1

    each value should be a random value, and you should sum them in the end to ensure the compiler / interpreter does not optimize all the work away because it detected that you never used the values

    • @ra2enjoyer708
      @ra2enjoyer708 9 หลายเดือนก่อน

      Pretty sure compiler won't be able to optimize side effects like this, since worker and the main thread only interact indirectly through events on message channel.

  • @abhijay_hm
    @abhijay_hm 10 หลายเดือนก่อน +1

    with the amount of time I've spent on this video because of the while loop, even the algorithm knows who my favourite youtuber is

  • @zeta_meow_meow
    @zeta_meow_meow 4 หลายเดือนก่อน

    seeing my cpu throttle and core usage rise in realtime was impresive :)

  • @JeremyThille
    @JeremyThille 9 หลายเดือนก่อน

    Niiiice we have the exact same machine! (And thanks for the video!)

  • @Bossslime
    @Bossslime 10 หลายเดือนก่อน +1

    I remember when I first learned workers, I didn’t realize k could use a separate js file so I wrote all of my code in a string, it was just a giant string that I coded with no ide help. That was fun.

  • @nullternative
    @nullternative 10 หลายเดือนก่อน +5

    I just recently experimented with the Offscreen Canvas handling rendering on a separate worker thread. Pretty cool.

  • @lionbryce10101
    @lionbryce10101 10 หลายเดือนก่อน +1

    Woulda been cool if you set it to show core usage on taskmgr

  • @HenokWehibe
    @HenokWehibe 9 หลายเดือนก่อน

    Just brilliant

  • @markopolo2224
    @markopolo2224 10 หลายเดือนก่อน

    man i been wanting something about workers for so long

  • @subratarudra2745
    @subratarudra2745 8 หลายเดือนก่อน

    Amazing🔥

  • @HedleyLuna
    @HedleyLuna 10 หลายเดือนก่อน +1

    I did use this back in 2018. I don't know how much it improved, but error handling was painful. Also, when you call postMessage(), v8 will serialize your message, meaning big payloads will kill any advantage you want. And also, remember that functions are not serializable. On the UI, I completely killed my ThreeJS app in production when I tried to offload some of its work to other threads :D
    Apart from that, you should NEVER share data between threads, that's an anti-pattern.

  • @vforsh
    @vforsh 10 หลายเดือนก่อน

    Wow, Love this tick - tock snippet

  • @Greediium
    @Greediium 3 หลายเดือนก่อน +2

    IM STILL STUCK OVER HERE, HELP!?!?!?!?
    MY PC WONT SHUTDOWN, ITS BEEN 5 MONTH'S...
    keep up the great work, love your vid's!

  • @VileEnd
    @VileEnd 10 หลายเดือนก่อน +1

    Love it, we are already doing that with our Lambdas - cause why not use the vCores when you got them 😍

  • @MegaMech
    @MegaMech 10 หลายเดือนก่อน +1

    A single x86 core can actually run more than one command at a time. And the n64 can run 1.5 commands at a time when it uses a branch delay slot.

  • @olharAgudo
    @olharAgudo 10 หลายเดือนก่อน

    Awesome video ending

  • @DranKof
    @DranKof 10 หลายเดือนก่อน +2

    I tried the while loop thing and somehow my computer became sentient. Y'all should try that out.

  • @CC-1.
    @CC-1. 10 หลายเดือนก่อน +1

    0:15 I already know this and already using this
    BLOB to create new Worker and going I use max 4 to 8 as one for each core

  • @BoloH.
    @BoloH. 10 หลายเดือนก่อน +4

    I once made a volume rendering thingie with Three.JS and it really, REALLY benefited from Web Workers, especially interpolation between Z slices.

    • @xinaesthetic
      @xinaesthetic 10 หลายเดือนก่อน +1

      Hang on… wouldn’t a volume-renderer in three.js be doing things like interpolation between z-slices in the fragment shader? Could certainly see workers being useful for some data processing (although texture data still needs to be pushed to the gpu in the main thread). Care to elucidate? Was it maybe interpolating XYZ over time, like with fMRI data or something? That would certainly benefit…

  • @TonyAlcast
    @TonyAlcast 10 หลายเดือนก่อน

    I'm still amazed at how you find such accurate images as the one at 0:32 🤔

  • @eformance
    @eformance 10 หลายเดือนก่อน

    Hyperthreading generally gives a 30% bump in performance, your test demonstrated that handily.

  • @bruc1555
    @bruc1555 10 หลายเดือนก่อน +3

    Please help, I have been trapped here for 5 years, the browser still won't let me out.

  • @ninjaasmoke
    @ninjaasmoke 10 หลายเดือนก่อน

    people watching on phone:
    “that level of genjutsu doesn’t work on me”

  • @gr.4380
    @gr.4380 10 หลายเดือนก่อน

    love how you tell us to leave a comment if it's locked like we can even do that

  • @4541047
    @4541047 10 หลายเดือนก่อน

    You are a youtube genius man

  • @tinahalder8416
    @tinahalder8416 10 หลายเดือนก่อน +27

    In python, handling Race Condition is easy,
    Use Queue, and Lock 😊

    • @dan_le_brown
      @dan_le_brown 10 หลายเดือนก่อน +2

      I achieved something similar in TS, but rather than locking the queue, I ensured that the jobs that could cause a race condition had a predictable unique ID. By predictable, I mean a transaction reference/nonce...

    • @techtutorial9050
      @techtutorial9050 10 หลายเดือนก่อน +1

      Well multiprocessing is much more mature than workers thread since multiprocessing has been the primary methods for concurrency in python, but for js it’s always been async.

  • @NoFailer
    @NoFailer 10 หลายเดือนก่อน

    I executed the while-loop on the orange youtube and I couldn't change the volume.... Thanks.

  • @Zumito
    @Zumito 10 หลายเดือนก่อน +1

    And remember, don't make promises you can't keep

  • @Rebel101
    @Rebel101 10 หลายเดือนก่อน

    Epic!
    It's FLAT!

  • @JeremyAndersonBoise
    @JeremyAndersonBoise 10 หลายเดือนก่อน

    Spawning workers in Node is not new, but support for web workers in browsers is comparatively new. Good shit man.

  • @NithinJune
    @NithinJune 10 หลายเดือนก่อน

    i wish you showed the CPU usage on each logical processor on task manager instead of the overview

  • @AnwarulIslamYT
    @AnwarulIslamYT 10 หลายเดือนก่อน +1

    JavaScript is referred to high level, single threaded, garbage collected, interpreted || jit compiled, prototype based, multi-paradigm, dynamic language with a, non-blocking event loop

    • @LedimLPMore
      @LedimLPMore 10 หลายเดือนก่อน

      And you can still program with multiple threads... 😂

  • @AchwaqKhalid
    @AchwaqKhalid 10 หลายเดือนก่อน +1

    3:17 Dude the 12900k has 16 physical cores (8p+8e) and a total of 24 threads since only the p cores have hyper-threading ❗

  • @dan-cj1rr
    @dan-cj1rr 10 หลายเดือนก่อน

    No clue if this could be an interesting video, but teach us about how to deploy on different environment ( ex: testing, production), as a junior i always don't know what this implies. Also show us tools to handle it. Thanks :)

  • @ko-Daegu
    @ko-Daegu 10 หลายเดือนก่อน

    0:31 concurrency incorporates parallelism
    what you should is asynchronism

  • @Xe054
    @Xe054 10 หลายเดือนก่อน

    Fireship, the "S" sounds in your video sound really harsh. Consider using a de-esser plugin or a regular compressor plugin and your stuff will sound fantastic. Cheers.

  • @RegalWK
    @RegalWK 10 หลายเดือนก่อน +5

    Every async thing you do goes to micro task or task queue, and every single one of them is executed on different thread, and once it’s done it goes back as message queue to micro task queue or task queue - when callstack is empty event loop takes firstly from microtask queue to callstack, later from task queue.
    Web workes once are done also goes to main thread to the callstack

    • @RegalWK
      @RegalWK 10 หลายเดือนก่อน

      Js is still One thread

    • @alexanderpedenko6669
      @alexanderpedenko6669 10 หลายเดือนก่อน

      Where did you find this info? As I know each thread has their own event loop, where micro and macro executes

    • @RegalWK
      @RegalWK 10 หลายเดือนก่อน

      @@alexanderpedenko6669 when you make some Async operation like promises, timers (settineout setinterval) js engine (v8/ whatever is in node) notice that it’s async operation and delegate it to proper web/node api which is write in cpp Lang. And there it executes it code and once it’s done those api return result of that operation to some queue and later event loop moves it to main thread

  • @jessejayphotography
    @jessejayphotography 10 หลายเดือนก่อน

    Elixir is faster than I thought and getting faster with the new JIT compiler improvements.

  • @sobeeeeer
    @sobeeeeer 10 หลายเดือนก่อน

    mindblowing intro

  • @victorpinasarnault9135
    @victorpinasarnault9135 10 หลายเดือนก่อน

    I saw this video of Code with Ryan.

  • @redhawk3385
    @redhawk3385 10 หลายเดือนก่อน

    To do this magically in c/c++ use openmp, in rust use rayon.

  • @jimbowers1298
    @jimbowers1298 10 หลายเดือนก่อน +2

    UNLIMITED VIEW TIMES!! AWESOME!! What a great video!

  • @mrcjm
    @mrcjm 10 หลายเดือนก่อน

    Ending is the moment you are glad you watched it on a mobile device

  • @PlayWithNiz
    @PlayWithNiz 10 หลายเดือนก่อน +1

    I'm thinking out loud here, but have a genuine question - Could you use workers combined with something like husky to do all pre-commit/push/etc checks at once?
    For example, I may have a large unit/integration test suite, followed by a large e2e test suite, along with code quality checks and so on... All of which are ran in sequence potentially taking upwards of a few minutes to complete.
    Could workers be used to run these jobs together at once?

    • @ra2enjoyer708
      @ra2enjoyer708 9 หลายเดือนก่อน

      E2E will bottleneck regardless, because of quadrillion OS APIs it has to interact on start, majority of them are synchronous.

  • @RajitRoy_NR
    @RajitRoy_NR 10 หลายเดือนก่อน +1

    What are some of the useful libraries which help or use workers? Like Partytown or Comlink

  • @DamonMedekMusic
    @DamonMedekMusic 10 หลายเดือนก่อน +1

    I've used the web worker API to filter multiple arrays at once and it's okay but it is very unintuitive to use and it could definitely be improved upon. Ideally for multiple Dom manipulation at once too not just data processing.

    • @Steel0079
      @Steel0079 10 หลายเดือนก่อน

      Now use the web worker where webpack is involved XD

    • @thecoolnewsguy
      @thecoolnewsguy 10 หลายเดือนก่อน

      ​@@Steel0079vite is the future

  • @Malthael134
    @Malthael134 10 หลายเดือนก่อน +1

    Just in time for my new browser game🎉

  • @jack171380
    @jack171380 10 หลายเดือนก่อน +1

    I wonder if there are things like mutex locks to help with the synchronisations of shared resources?

  • @wlockuz4467
    @wlockuz4467 10 หลายเดือนก่อน +2

    I thought worker threads were virtual threads. you learn something new everyday!

    • @shimadabr
      @shimadabr 10 หลายเดือนก่อน

      Aren't they? My understanding is that they are threads managed by the runtime, which in turn is responsible for allocating the appropriate amount of real threads on the O.S.

  • @mateuszabramek7015
    @mateuszabramek7015 10 หลายเดือนก่อน

    Exactly. I don't know why I keep hearing otherwise

  • @dave6012
    @dave6012 10 หลายเดือนก่อน

    Mr jeff will you do one on creating a websocket server in node js?

  • @dovanminhan
    @dovanminhan 10 หลายเดือนก่อน

    Hi from Vietnam, where the kitchen image was taken.

  • @theshermantanker7043
    @theshermantanker7043 3 หลายเดือนก่อน

    3:11 Notice how in that graph, the only languages faster than Java are all systems languages, with no VM based languages capable of beating it

  • @akashrajpurohit97
    @akashrajpurohit97 10 หลายเดือนก่อน

    6:42 bro really doubled it and gave it to the next thread

  • @soulofjack7294
    @soulofjack7294 10 หลายเดือนก่อน

    thanks for hanging

  • @s0up1e
    @s0up1e 10 หลายเดือนก่อน

    So weird, this was an interview question yesterday.

  • @threeveloper
    @threeveloper 10 หลายเดือนก่อน +1

    HELP It's been 84 years and I still haven't been able to close my browser

  • @hyper_channel
    @hyper_channel 10 หลายเดือนก่อน +8

    a small detail at 3:17 your i9 has 16 physical cores not 8. Only half of them have hyperthreading (because there are 2 types of physical cores in that cpu). That's why it has 24 threads instead of 32

    • @somedooby
      @somedooby 10 หลายเดือนก่อน +4

      I think he just said that so people would comment, increasing the algorithm rizz

    • @hyper_channel
      @hyper_channel 10 หลายเดือนก่อน +1

      @@somedooby I wouldn't be surprised TBH, you certainly can't get that audience so quickly without knowing all the tricks

    • @varianbohling251
      @varianbohling251 10 หลายเดือนก่อน

      Also right click the cpu graph and choose logical processors to show the threads in individual graphs. Makes it easier to visualize IMHO.

  • @debarkamondal6406
    @debarkamondal6406 10 หลายเดือนก่อน

    Dude he is helarious

  • @user-xe8ic6jq3v
    @user-xe8ic6jq3v 6 หลายเดือนก่อน

    Node js will greatly enhance C languages, their performance increases in proportion to the number of cores and memory consumption does not increase

  • @DanFigueras
    @DanFigueras 10 หลายเดือนก่อน

    Day 5, I'm still stuck with the window open, I tried exit the house and get back in. Rick is still singing.

  • @SentientSkeletorClipLoop
    @SentientSkeletorClipLoop 10 หลายเดือนก่อน

    Still here. Stuck in a time warp.

  • @user-ir2fu4cx6p
    @user-ir2fu4cx6p 10 หลายเดือนก่อน

    CPU had multi threading ability years before multicore it called instruction Pipeline & Superscalar without it even with 4 cores CPU it will struggle to do the simplest tasks

  • @riendlyf
    @riendlyf 10 หลายเดือนก่อน

    Can you cover native threads vs green threads?

  • @SinanWP
    @SinanWP 10 หลายเดือนก่อน

    7:40 I knew the joke coming from mile away
    nice one 😂😂😂😂