4 ms·
It's not about overloading. JavaScript language doesn't have integers, only floats. JS engine has to use floating point add for (x + y). It's slower that integ
by ash 14y ago
It's not about overloading.
JavaScript language doesn't have integers, only floats. JS engine has to use floating point add for (x + y). It's slower that integer add. But (x + y) | 0 truncates any float values that could theoretically come up, allowing JS engine to safely optimize it by using integer add directly.