Promise.{all, race, allSettled} lookup the constructor of the receiver on every iteration of the loop. Instead, this change makes the lookup happen only once outside the loop.


To optimize away the Get and Call of the resolve method on the constructor, I'd have to check the constructor to see if its resolve method has been modified or not. If it's not been modified, I can directly call (or even inline) the builtin %PromiseResolve%, saving the lookup and call overhead for faster performance. Without this patch, I would have to check against the constructor for every iteration of the loop before going to the fast path. With this patch, I can do a check against the constructor just once at the beginning. The change in behavior with this patch is that if you modify the constructor's resolve property in the middle of iterating the iterable argument, then it is not observed.



Specification link

Unknown standards status - check spec link for status

Status in Chromium


In development (tracking bug)

Consensus & Standardization

After a feature ships in Chrome, the values listed here are not guaranteed to be up to date.

  • No signal
  • No signal
  • No signals


Last updated on 2022-01-21