proposal-symbol-thenable icon indicating copy to clipboard operation
proposal-symbol-thenable copied to clipboard

Performance implications

Open littledan opened this issue 7 years ago • 2 comments

It's been very complicated and tricky to optimize the performance of Promises in JavaScript engines. This proposal adds another Get to the Promise resolution path, which could degrade performance further. Is it worth that cost, when there are alternatives like special-casing Module Namespace objects? cc @gsathya

littledan avatar May 21 '18 21:05 littledan

Keeping in mind poor perf is something that can generally be improved and ES6+ additions tend to have plenty of things to improve on that front... a single Get in an asynchronous operation is not likely to be a bottleneck.

jdalton avatar May 21 '18 22:05 jdalton

Presumably it wouldn't be any less performant than the (potentially polluted) [[Get]] on .then itself? All of the same optimizations currently used to determine when Promise.prototype.then is present, unmodified, and unshadowed, could surely be used to ensure that Symbol.thenable was not present (or was set to true) on Promise.prototype as well?

ljharb avatar May 21 '18 22:05 ljharb