4 ms·
>CPU: We gave users a 16 core machine just for their browser, but it turns out that the web is largely limited by single core performance (think JS, layout, htm
by gruez 4y ago
>CPU: We gave users a 16 core machine just for their browser, but it turns out that the web is largely limited by single core performance (think JS, layout, html parsing, etc).
I'm pretty sure that javascript being largely single-threaded was well known knowledge since day 1. Did they not know this? Did they think that mulit-threaded javascript was just around the corner?
- deleted 4y ago[deleted]
- quickthrower2 4y agoJS 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.
- ignoramous 4y agoIf each of the 100 open tabs are all run in separate threads, then there are a 100 active threads. I think what TFA means to convey is, the user is interacting with only a single tab at any given point in time; hence any percieved gains are bounded by single core perf. And that there weren't that many web-native apps using service workers to make any material difference to the UX to justify the cost of running just Chrome on a 16-core i9 machine.
- stonemetal12 4y agoJava uses multiple threads even for single threaded code, the JIT compiler has threads, the garbage collector has its own separate threads. I don't see why a JS implementation wouldn't be multi-threaded even if it is presenting a single threaded environment. Seems crazy to not know your application's performance profile before picking out the hardware to run it.