The Web Workers API lets users create dedicated worker threads in the browser to run a specified script.
To use SharedArrayBuffer (the primary way web workers can share memory) the Cross-Origin-Embedder-Policy and Cross-Origin-Opener-Policy
headers must be set to require-corp and same-origin.
python -m http.server is typically my go to run quickly a http server, but i couldn’t find an easy way to set headers - so i ended up using FastAPI.
“Parallelism is about physically doing two or more things at the same time. Concurrency is about undefined, out of order, execution.” - William Kennedy
Javascript typically isn’t the first language that comes to mind when you think of concurrent & parallel programming - i’d imagine c++, go, and elixir are higher up on the list.
Despite preconceived notions (i myself didn’t think that javascript could be parallel, especially on the client) javascript is definitely concurrent - and even parallel at times.
You know something is done well when you don’t even think about it. I caught myself playing with the coinbase price chart over the past few days without realizing it
(not a good idea to check every day, but bull runs will do that to you).
I didn’t really have a good idea of how they did it as well (repeating linear gradient for the dots? each line is a div? how’d they change opacity based on cursor position? - and only for half of the chart?).