How babel implements Set / Map polyfills

My question is related to the computational complexity of Set / Map polynomials, Weak Set / Weak Map by Babel? Afaik does not have ES5 language functions that allow you to directly implement Set / Map, and therefore there may be a situation where Set / Map can use the Array structure under the hood to implement an object link search, which will lead to O (N) search performance. And here is the question:

What is the computational complexity of Set / Map searches?

Thank you in advance!

+6
source share
1 answer

Babel uses core-js for its polyfill, from the GitHub repo :

core-js uses its own collections in most cases, just fixes the methods / constructor if necessary, and in the old environment, quickly polyfill (O (1) search) .

(Emphasize mine)

And if you are interested in an exact search, it is in this file . It is not supported by an array.

+7
source

All Articles