News for hackers. Stuff that matters.
Re:Rust’s async isn’t colored by vbsteven on Thursday March 11, 2021 @01:10PM (#26427069)
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.

Re:Rust’s async isn’t colored by MaxBarraclough on Friday March 12, 2021 @03:20AM (#26433352)
> 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.