Hacker News new | ask | show | jobs
by Inviz 333 days ago
Chaining promises like this is not a good idea for high throughput cases (creates gc pressure), but perfectly valid for regular cases.
1 comments

Huh?

It creates 1 object allocation per enqueue.

yeah 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.
There are zero closures here.