My question is related to computational complexity of Set / Map, Weak Set / Weak Map polyfills by Babel? Afaik there are no ES5 language features allowing to implement Set / Map directly, and so it might happen that Set / Map might use Array structure under the hood to implement lookup by object reference which would yield to O(N) lookup performance. And so the question is:
What is the computational complexity of Set / Map lookup operations?
Thank you in advance!
Babel uses core-js for its polyfill, from the GitHub repo:
core-js uses native collections in most case, just fixes methods / constructor, if it's required, and in old environment uses fast polyfill (O(1) lookup).
(Emphasis mine)
And if you're interested in the exact lookup, it's in this file. It's not backed by an array.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With