9 ms·
Possibly, but the types by a VM are rarely guaranteed to be completely accurate (some traps will be included in optimised code to capture the cases where types
by aardvark179 12y ago
Possibly, but the types by a VM are rarely guaranteed to be completely accurate (some traps will be included in optimised code to capture the cases where types may not be as expected). They may only be true for the particular input data, other other libraries used, or stuff like that.
Using previous runs to inform the JIT of expected types is entirely reasonable though, and think various JS implementations already do this.
- leeoniya 12y ago> some traps will be included in optimised code to capture the cases where types may not be as expected none of that should matter. if the resulting JIT'd code is faster with the traps than the plain js without them, so be it.