JS in parallel – heavy duty in the browser
summary
Edge detection uses a Sobel operator over a 1920×1080 frame and runs about 2.6 seconds blocking on the main thread, freezing UI. Moving the pixel array to a Web Worker via a transfer list avoids copy and keeps the tab responsive; splitting work across workers roughly divides time by CPU cores. Offloading to the GPU with WebGL drops processing to ~827 ms via the compositor. Mentions SharedArrayBuffer, SIMD and WebAssembly as upcoming optimizations.
AI-written summary · about
