|
|
|
|
|
by setzer22
2141 days ago
|
|
Genuine curiosity: How can it check the types at the call side quickly? Let's say I have a function that averages an array of floats. Does the JIT have to check each of the array's inputs to have the right type? That looks like it could become a serious overhead. |
|
If those stats prove that it is always an array of floats, then machine code gets generated for an array of floats, with a trap handler for when the code fails.
The trap handler, if called, will throw away the code and restart the analysis.
So if you are nice for the compiler and keep your types regular, the machine code will not be thrown away and there are no speed bumps.