Can JavaScript Go Faster? Threading in JavaScript (Data Structures & Optimization)
HTML-код
- Опубликовано: 15 авг 2021
- Can you make JavaScript run even faster? Or is it limited as a single thread language?
Patreon: / simondevyt
Follow me on:
Twitter: / iced_coffee_dev
Instagram: / beer_and_code
Github: github.com/simondevyoutube/
In this video we talk a bit about JavaScript's mechanisms for concurrency and spreading the work out over multiple threads/cores. We'll cover the web worker API in a bit of detail, dedicated workers, and then we'll move on to creating a small testing setup. It's kind of interesting to explore the threading opportunities that JavaScripts offers through the Web Worker API, the various pitfalls and performance footguns that lurk there, and what you can do to mitigate these issues. We'll also explore using transferable objects with ArrayBuffer, and touch quickly on what SharedArrayBuffer unlocks in terms of concurrency and multiple threads reading/writing.
Links:
developer.mozilla.org/en-US/d...
surma.dev/
surma.dev/things/is-postmessa...
v8.dev/docs/embed
developer.mozilla.org/en-US/d...
developer.mozilla.org/en-US/d...
developer.mozilla.org/en-US/d...
developers.google.com/web/upd...
en.wikipedia.org/wiki/JavaScript
And yes, Node also has threads:
nodejs.org/api/worker_threads...
Honestly this is some of the most edge case Javascript stuff I have ever seen. I love it so muchhhh
Have half an hour of work to kill and didn't want to assign myself a new ticket, then this popped up - truly godsent :D
we frontend developers usually don't know about this stuff, so it would be nice if you explain what threading was, just a brief explanation would be good. though i think i got the idea in the end
Your Javascript lessons are "The Best", your experience talks for itself 🔥
I feel like I actually learned about web workers and have a better understanding of what they are and how they work. Way better than random google searches!
CS wizardry 💥
This is quickly becoming one of my favorite JS channels
You may be able to see performance gains if you structure the workers as a predefined pool which pulls from a queue of callbacks to prevent unnecessary worker instantiation.
JavaScript (more specifically in Node)
I'm actually really looking forward to the new Dune movie 😂
If this helped you in any way and you'd like to support future vids:
8:20
would really appreciate more videos on multi-threading with Javascript.
Great video! This is the first video i have seen going deeper into the js threads. Please keep posting more content like this. Do you have blog where you post the video content in text format? That will be great for quick reference.
Thank you! Thank you! Thank you! I really wanted to see a video from you that included threading!
Always a pleasure to watch your content. Thanks for putting these together. ❤👍
Well explained video on using transferrables. I'd love to see a followup on using Shared Array Buffers with Atomics. It'd be nice to see a tech breakdown on typed arrays and how to properly implement them. I'm currently using transferrables for 3D physics animation but would appreciate any insights into making that faster. With 3D simulations I've found every millisecond counts.
Lovely! Quality work as always Simon!
Simon you are awesome, I wrote something similar about the JS workers in the other video, but never thought you would actually make it, very thorough I am actually impressed on your dedication!
Amazing video!