In practice, if you’re going to make me have to use a promise to, say, decrypt 1kB of data using AES, I’m just going to use a wasm implementation of AES instead of turning my code into callback soup.
-
-
Replying to @pcwalton @BRIAN_____ and
JS regexps after Perl are NFAs (backtracking), can go exponential. This would never have justified making their APIs async, even if I had had promises in 1997 when I prototyped what became ES3 regexps. It seems fruitless to try to prevent main thread jank by crippling such APIs.
1 reply 0 retweets 1 like -
This Tweet is unavailable.
-
It could be but I expect people will do what Patrick said: use wasm only. That may be "ok" but if the intention was to help JS programmers as such, not so great by that measure. Programmers can jank the UX in many ways, just using loops and recursion ;-).
1 reply 0 retweets 1 like -
Replying to @BRIAN_____ @BrendanEich and
I think the rule of thumb I floated makes sense. If it blocks your CPU core, it’s sync. Otherwise, it’s async.
1 reply 0 retweets 1 like -
Replying to @pcwalton @BRIAN_____ and
Could you define “block” just to be sure? Thanks.
1 reply 0 retweets 0 likes -
Replying to @BrendanEich @BRIAN_____ and
Handwavy: “an operation blocks the thread if, semantically, no subsequent operations are executed until the blocking operation completes.” (I say “semantically” to leave an opening for superscalar implementations.)
1 reply 0 retweets 2 likes -
Replying to @pcwalton @BrendanEich and
So AES-NI is blocking by this definition, because it’s a set of CPU instructions. A crypto coprocessor that communicates with main CPU via a FIFO, OTOH, would not be blocking.
2 replies 0 retweets 0 likes
Compare: Canvas 2D is implemented (for now!) as immediate mode on CPU, so it’s blocking. WebGL is done with a coprocessor, so it *should* ideally be async. The fact that GL is largely not an async API is a pain point and it’s what Vulkan/WebGPU remedy.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.