07:56 | <Rob Palmer> | FYI: https://twitter.com/jarredsumner/status/1614646182269313025 |
20:58 | <littledan> | native AsyncContext should be more efficient than AsyncLocalStorage because it hooks into the microtask queue in a less flexible way (just storing a pointer, rather than calling a callback |
20:59 | <littledan> | Is Yoav active on matrix? Seems like Yoav didn't send messages in the room. |
22:37 | <James M Snell> | The implementation of ALS that we have in workers now is quite a bit more efficient than Node.js' but still has a fairly sizable cost due to the way promise hooks are implement |
22:39 | <James M Snell> | Specifically, not only do we have to handle the promise hook for init, pre and post callback, and resolve, for every promise we have to allocate an object to store as a private field since v8 does not give us any mechanism for storing additional context on the Promise object (i.e. we can't dedicate an aligned internal fields to use) |
22:43 | <James M Snell> | For each Promise, the object we allocate is a opaque wrapper around a ref to the ref-counted "async context frame" that is storing the relevant context |
22:44 | <James M Snell> | So we do need more than storing a simple pointer but there is tons of room for improvement still |
22:54 | <littledan> | yeah a naive built-in implementation would address these issues |
22:55 | <James M Snell> | absolutely doesn't need to be much |