6 ms·
Chaining promises like this is not a good idea for high throughput cases (creates gc pressure), but perfectly valid for regular cases.
by Inviz 1y ago
Chaining promises like this is not a good idea for high throughput cases (creates gc pressure), but perfectly valid for regular cases.
- paulddraper 1y agoHuh? It creates 1 object allocation per enqueue.
- Inviz 1y agoyeah but it creates closure as well, which typically references some objects that isn't easy to GC. So if you have long-living promise with some data captured in closure, it will not be cleared. So doing then().then().then() may not release objects referenced in callbacks that resolved time ago.
- paulddraper 1y agoThere are zero closures here.