4 ms·
Stuff like parsing JSON is typically still blocking. I’m sure there are other forms of blocking computation. JS being single threaded means that while some tra
by vbsteven 6y ago
Stuff like parsing JSON is typically still blocking. I’m sure there are other forms of blocking computation.
JS being single threaded means that while some tracker is parsing a big json blob your website becomes unable to handle input events until the tracker is done.
Let’s say there is an option to do this in some form of threaded worker or coroutines then the main UI thread does not become blocked.
- MaxBarraclough 6y ago> Stuff like parsing JSON is typically still blocking. I’m sure there are other forms of blocking computation. I agree that it's a neat idea to use asynchrony to move specific heavyweight browser-native computations out of the JavaScript thread, but is JSON parsing really a significant performance issue? > JS being single threaded means that while some tracker is parsing a big json blob your website becomes unable to handle input events until the tracker is done. I'd rather parallelism not be a viable option for accelerating trackers. Users are known to hate unresponsive UIs. I'd rather that web trackers bring an unavoidable performance penalty. > Let’s say there is an option to do this in some form of threaded worker or coroutines then the main UI thread does not become blocked. You've just described the Web Workers API. I don't know whether today's tracker scripts use Web Workers. I imagine probably not though, I think the Web Workers API is only appropriate when you're doing substantial computation.