GridVids
Sign in with YouTube

Can JavaScript Go Faster? Threading in JavaScript (Data Structures & Optimization)

SimonDev Aug 16, 2021 14:00
Create an account to hide videos, mark them watched, or save them to Don't Miss.
Don't Miss
Create an account to hide videos, mark them watched, or save them to Don't Miss.
Mark watched
Create an account to hide videos, mark them watched, or save them to Don't Miss.
Hide
Open in popup Open on YouTube
Share video

Share video

Copy the GridVids link or iframe code.

Video link
Iframe code
Iframe content

Can you make JavaScript run even faster? Or is it limited as a single thread language? Patreon: https://www.patreon.com/simondevyt Follow me on: Twitter: https://twitter.com/iced_coffee_dev Instagram: https://www.instagram.com/beer_and_code/ Github: https://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: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API https://surma.dev/ https://surma.dev/things/is-postmessage-slow/ https://v8.dev/docs/embed https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer https://developer.mozilla.org/en-US/docs/Web/API/Worker/postMessage https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm https://developers.google.com/web/updates/2011/12/Transferable-Objects-Lightning-Fast https://en.wikipedia.org/wiki/JavaScript And yes, Node also has threads: https://nodejs.org/api/worker_threads.html
Science & Technology
#simondev #game development #programming tutorial