r/programming • u/kciter • 8h ago
The Browser's Main Thread Is Expensive
https://kciter.so/posts/the-expensive-main-thread/en/4
u/sionescu 1h ago edited 50m ago
It shows how much the DOM and Javascript are garbage compared to the desktop C++ frameworks. I remember going over a Qt tutorial long time ago, which was implementing a spreadsheet, and the code has a simple loop where at the end of each line, it called commit() - the equivalent of yielding - but it was short, easy to read and performant; whereas this whole article spends an inordinate amount of words discussing the finer points of how to yield in various situations, because there's not built-in that works well out of the box. Madness.
1
u/Somepotato 13m ago
Omitting shared memory buffers and atomics when discussing workers is a little strange.
Workers can also render things to canvases off the main thread.
-10
6h ago
[deleted]
21
16
39
u/Rhed0x 7h ago edited 7h ago
Good article.
One day JS will reach the 21st century and support proper multithreading. Obviously won't help for UI updates but for things like parsing large files.
Workers are a massive pain in the ass, JS should just share memory with additional threads and get proper synchronization primitives like every language.
But what can you expect from a programming language that doesn't even have integers.