2 ms·
>In JavaScript at least code needs to be monomorphic to be compiled so if something is almost always called with one type, but occasionally another you can get
by coldtea 4y ago
>In JavaScript at least code needs to be monomorphic to be compiled so if something is almost always called with one type, but occasionally another you can get a massive slowdown (at least in the past I'm assuming this is still the case).
Iirc, V8 has several layers of smarts to deal with this.