3 ms·
JS is single threaded, but does a browser use that same thread for rendering, animations, web workers, network etc.? How much front end JS code is intensely com
by quickthrower2 4y ago
JS is single threaded, but does a browser use that same thread for rendering, animations, web workers, network etc.? How much front end JS code is intensely computational vs. simply spending most of its time waiting on a callback?
Genuine question - I might see if I can find out next time I have to do a performance profiling in Chrome!
- deleted 4y ago[deleted]
- itake 4y agoAFAIK, rendering and animations are on the same thread as JS. web workers have their own thread, but I think adoption is low. Network requests are async (JS doesn't have to wait for the network request for it to do other things), but JS can still only start one network request at a time.
- kevingadd 4y agoThe design of web APIs means that a lot of stuff has to happen as if it were on the main UI thread, so while you can do fork/join stuff to optimize it - for example, doing layout in parallel, etc - you're still bottlenecked by how fast the main thread is able to do all the stuff it needs to do. This is why many APIs disallow synchronous use or have serious constraints on synchronous use now.